Re: [OT] java question string parsing
Re: [OT] java question string parsing
- Subject: Re: [OT] java question string parsing
- From: Q <email@hidden>
- Date: Tue, 12 Jun 2007 19:10:26 +1000
On 12/06/2007, at 6:15 PM, Ute Hoffmann wrote:
hallo,
is there someone around who can give me a hint how I could parse a
String like "VollstaendigReonviert" into "Vollstaendig Reonviert"?
Of course I do not know what is in the string beforehand, thus I
need a means to check whether there are capital letters inside of
the string and where. The remaining part is easy.
Any ideas?
Try this:
import java.util.regex.*;
...
String patternStr = "(?<=.)([A-Z])";
String replaceStr = " $1";
Pattern pattern = Pattern.compile(patternStr);
Matcher matcher = pattern.matcher(originalStr);
String newStr = matcher.replaceAll(replaceStr);
Thanks,
Ute
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.com
This email sent to email@hidden
--
Seeya...Q
Quinton Dolan - email@hidden
Gold Coast, QLD, Australia
Ph: +61 419 729 806
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden