File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
JavaRanch
»
Java Forums
»
Java
»
Beginning Java
Author
how do i get substring?
Gemini Moses
Ranch Hand
Joined: Jan 04, 2001
Posts: 244
posted
Feb 13, 2002 12:25:00
0
String
S = filename.ext
I need the "ext" part of this string.
How can I get that?
Thanks
Jessica Sant
Sheriff
Joined: Oct 17, 2001
Posts: 4313
I like...
posted
Feb 13, 2002 12:52:00
0
Like this:
String S = "filename.ext"; //First get the position of the . int index = S.lastIndexOf( '.' ); //Then get the string from just after the . to the end String substring = S.substring( index + 1 );
Check out the API for
java.lang.String
and
java.lang.StringBuffer
for more methods.
- Jess
Blog:
KnitClimbJava
| Twitter:
jsant
| Ravelry:
wingedsheep
Gemini Moses
Ranch Hand
Joined: Jan 04, 2001
Posts: 244
posted
Feb 13, 2002 13:07:00
0
Thanks Jessica for your quick help.
I am done with my code!!
Thanks a lot
I agree. Here's the link:
http://ej-technologies/jprofiler
- if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
subject: how do i get substring?
Similar Threads
how can i get a String's encoding..
encoding and decoding in java
String representation of a org.w3c.dom.Document object
How to get a String contain ""?
Sending XML data to webservice
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter