This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Splitting a string Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Splitting a string " Watch "Splitting a string " New topic
Author

Splitting a string

anoop kerala
Greenhorn

Joined: Mar 03, 2010
Posts: 10
Hi,
i want to split a string for example
1) @a.b=@c.d+@e.f;

one output i want is a,c,e which has got prefix '@'

second output i want is is b,d,f which has got prefix '.'

i prefer a solution with regex please..

thanks in advance
lenin
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

Check out java.util.regex.Pattern. It has lots of information on regexes in Java. Especially check out what capturing groups do.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37940
    
  22
Rob Prime wrote:Check out java.util.regex.Pattern. It has lots of information on regexes . . .
There is lots more information in the tutorials, eg this one.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Why do you want to use regexes? I'm not convinced that's the easiest solution to this problem.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Splitting a string
 
Similar Threads
Convert OutputStream data to String
Post increment and Pre Increment Precedence
fibonaccei with threads
detecting taglib present or missing
prefix increment operator doesn't increment until after for loop has completed