on 09-26-2007 8:47 AM
Hi everybody,
I got to split a string when <b>'</b> occurs. But the string should <u>not</u> be splitted, when a <b>?</b> is leading the <b>'</b>. Means: Not split when <b>?'</b>
How has the regular expression to look like?
This does NOT work:
String constHOCHKOMMA = "[^?']'";
<u>Sample-String:</u>
String edi = "UNA'UNB'UNH?'xyz";
Result should be
UNA
UNB
UNH?'xyz
Thanks regards
Mario
Hi
Can you please explain what is that, and how it works
Regards
Abhijith YS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks,
I got the answer in another forum:
String constHOCHKOMMA = "(?<!
?)'";
Regards Mario
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
I think u can meke it in two ways
1. using split function u r giving single quote as your delimiter, after each split funcction just add one more split function with delimiter as ?, if it returns true add the previous splited string and next one
2. you are gooing through each and every char of your string and split when next single quote occur, for this u are comparing each of your char with ['] i believe,
just compare the char with '?' if it match ignore next single quote.
Regards
Abhijith YS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.