aspose file tools*
The moose likes Beginning Java and the fly likes Formatting a String Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Formatting a String" Watch "Formatting a String" New topic
Author

Formatting a String

Kamal Patel
Greenhorn

Joined: Nov 05, 2003
Posts: 18
Hi,
I am trying to format a string e.g.
"ou=Applications"
to just extract the "Application" part of the string?
I think you can use the StringTokenizer class and "=" as a delimeter, but I tried that and it did not work for me!
Can someone please tell me how to do this and give me an example piece of code if possible?
Thanks.
Tom Wolve
Ranch Hand

Joined: Sep 22, 2003
Posts: 32
Hi,
hope the following code fragment will help
Brian Pipa
Ranch Hand

Joined: Sep 29, 2003
Posts: 299
You can also use String.indexOf("=") to see where the equals sign is then use String.substring() to just grab everything after the =
Brian


My Java Freeware:<br />MACCC - <a href="http://maccc.pipasoft.com" target="_blank" rel="nofollow">http://maccc.pipasoft.com</a><br />Nator - <a href="http://nator.pipasoft.com" target="_blank" rel="nofollow">http://nator.pipasoft.com</a>
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Formatting a String