aspose file tools*
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 Java 8 in Action this week in the Java 8 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: 19556
    
  16

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: 36579
    
  16
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
fibonaccei with threads
prefix increment operator doesn't increment until after for loop has completed
Convert OutputStream data to String
detecting taglib present or missing
Post increment and Pre Increment Precedence