This week's book giveaway is in the Android forum.
We're giving away four copies of Android Programming: The Big Nerd Ranch Guide and have Bill Phillips & Chris Stewart on-line!
See this thread for details.
Win a copy of Android Programming: The Big Nerd Ranch Guide this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Splitting a string  RSS feed

 
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
Posts: 20968
84
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
Posts: 54581
151
  • 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
Boost this thread!