• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Splitting a string

 
anoop kerala
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20545
56
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out java.util.regex.Pattern. It has lots of information on regexes in Java. Especially check out what capturing groups do.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49361
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you want to use regexes? I'm not convinced that's the easiest solution to this problem.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic