There will always be people who are ahead of the curve, and people who are behind the curve. But knowledge moves the curve. --Bill James
There will always be people who are ahead of the curve, and people who are behind the curve. But knowledge moves the curve. --Bill James
However, I wasn't able to figure out a quick way (i.e. one step to: pick the string between # and the first ,") before my post.
Originally posted by Henry Wong:
Here you go...
Henry
Originally posted by Campbell Ritchie:
A bit late, BUT:
Your first split() on # produces a String[] array, and you could then create a String[][] array; you split the first member of your String[] with , into a String[] array which is now the first member of the String[][] array.
Is there any to only show the content in between the "/" and "," (excluding "/" and ",")?
[Pedantic mode]There is no such thing as a multi-dimensional array in Java. What I suggested was an array of arrays.[/Pedantic mode]Originally posted by Ricky Murphy:
multi-dimensional array
-Rick
Originally posted by Campbell Ritchie:
[Pedantic mode]There is no such thing as a multi-dimensional array in Java. What I suggested was an array of arrays.[/Pedantic mode]
Originally posted by Henry Wong:
First of all, why "/"? Your example uses "#".
Second, take a look at the code again -- mine doesn't need to replace anything. It uses groups to extract the content in-between. (notice the group(1) call)
Thanks Henry. First of all, it should be # as I stated in my first post. what happened was after weekend, we started to deal with with "/" in a similar case. when I posted my code Tuesday, I changed the regex portion to comply with my original post but I forgot to change the "/" sign in the while loop.
Second, yes, you are right. the group(1) did it. This is my first time using the regex/pattern/match. my original understand on group() method was off. I did a further reading today and understand how to use number for group. Learned a lot. Thank you.
Henry
[ March 26, 2008: Message edited by: Henry Wong ]
He puts the "turd" in "saturday". Speaking of which, have you smelled this tiny ad?
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
|