permaculture playing cards
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
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
Rancher

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

might do the trick.
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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: java String doubt
 
It's not a secret anymore!