Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2006

Tip: Looking for answers? Try searching our database.

Help: java newbie with midterm in 1 hr

Thread view: 
C_Kubie - 07 Mar 2006 23:00 GMT
Yeah. I know... I suck and I should 'learn how to google'...
I need help edit strings.

I have a string that is lastname,firstname

What command is used to delete everything up to the comma?
How do I delete everything before the comma?

All suggestions welcome..

kubie
AG - 07 Mar 2006 23:17 GMT
String  name = "firstName,LastName";

name =  name.substring(name.indexOf(',')+1, name.length()));

> Yeah. I know... I suck and I should 'learn how to google'...
> I need help edit strings.
[quoted text clipped - 7 lines]
>
> kubie
mike - 07 Mar 2006 23:17 GMT
I would do:

String newString = oldString.substring(oldString.indexOf(','));

There might be a better way, but that will return a new string of
everything up to and not including the ','
mike - 07 Mar 2006 23:19 GMT
yeah.  oldString.indexOf(',')+1

My bad.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.