This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Java in General and the fly likes java String doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "java String doubt" Watch "java String doubt" New topic
Author

java String doubt

elilvannan nagarajah
Greenhorn

Joined: Apr 17, 2005
Posts: 8
How can i get content inside double brackets in a String in JAVA.
For Example String test="furious{ex1234}";
i want to get the "ex1234" from above string test.
any methods available to get the content beween {}.


SCJP 1.4<br />SCWCD 1.4 <br />SCBCD 1.3<br />SCEA (Part1)
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
test.substring(test.indexOf("{")+1, test.indexOf("}"))

might do the trick.


Ping & DNS - updated with new look and Ping home screen widget
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
If you are using JDK1.4 or later, take a look at regular expressions.


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
elilvannan nagarajah
Greenhorn

Joined: Apr 17, 2005
Posts: 8
Thanks "Ulf Dittmer" and "Ilja Preuss".
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java String doubt
 
Similar Threads
java v6 regex question
Question on jar files and classpath.
Can any one please tell the reason for the String related question.. given here
can not send jsp param when using HttpServletRequestWrapper ?
Reading mail content