Sunday 15 January 2012

Inserting punctuation marks in a java String -


Is there a custom way to insert punctuation in Java string?

Small programs:

  class punctuation {public static zero main (string [] args) {string greeting = "hello how are you"; Println ("Hello"); }}   

Desired Output: Hello, how are you?

How about:

  string greetings = "hello" + "," + "How are you";   

or this:

  string greetings = "hello how are you"; Best wishes = best wishes. (0, 5) + "," + Good luck. "(5);   

Or this:

  string greetings =" hello how are you "; greetings = new stringbilders (greetings) .inet (5 , ","). ToString ();   

Inserting a punctuation is trivial if you know where should go to it but if you already The right place is not known, so it is impossible!

No comments:

Post a Comment