aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Spliting a String from a particular character Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Spliting a String from a particular character" Watch "Spliting a String from a particular character" New topic
Author

Spliting a String from a particular character

abhinas raj
Ranch Hand

Joined: Jun 02, 2012
Posts: 47
i want to split a String from a particular character please some one write the code how to do that

String str1="city-state";

i wnat "city" and "state" to be stored in two different seperate variable. like in str2 and str3 how to do that .
Jelle Klap
Bartender

Joined: Mar 10, 2008
Posts: 1763
    
    7

Well, nobody is going to write that code for you, nor should they. Beside the fact that JavaRanch is NotACodeMill (<- click) this sort of thing is very important to master yourself. Especially considering the forum you posted this in. If you take a look at the String API, under Method Summary, you should be able to find a method that will allow you to do what you're looking for. Let's start by identifying that method.


Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Spliting a String from a particular character