This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes String handling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "String handling" Watch "String handling" New topic

String handling

Priyadharshini Nagarajan

Joined: Sep 24, 2004
Posts: 22

String x = new String("hai welcome , ");

tell me how i can remove that last comma and space..
Vijayendra V Rao
Ranch Hand

Joined: Jul 04, 2004
Posts: 195

A better way would be:

Vijayendra <br /> <br />"The harder you train in peace, the lesser you bleed in war"
Priyadharshini Nagarajan

Joined: Sep 24, 2004
Posts: 22

i have to delete the last comma and space
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

This should really be in Java/Basic but, since your here....

Assuming you know that it will consistently be a ", ".

If there are other variations that will need to be handled, look at the String's lastInstanceOf and trim methods, or better, if you can use jsdk1.4 or higher, the regexp tools that now ship with Java.
[ January 21, 2005: Message edited by: Ben Souther ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: String handling
Similar Threads
Tech Word Game
date format with MS Access database
ResultSet to Array
WA #1.....word association
How to convert byte array into string array?