giggetto71 Active Member Licensed User Longtime User Apr 23, 2021 #1 Hi, I am facing a strange issue trying to split a string separated by ".". B4X: dim Text1 as string, TempList as List sf As JStringFunctions Text1 = "info1.info2" TempList = Regex.Split(".",Text1) 'or' TempList = sf.Split(Text1,".") in both cases TempList is empty while it works (for both cases) just fine with any other separator (",",";",etc..). Any reason why "." is not working? thanks
Hi, I am facing a strange issue trying to split a string separated by ".". B4X: dim Text1 as string, TempList as List sf As JStringFunctions Text1 = "info1.info2" TempList = Regex.Split(".",Text1) 'or' TempList = sf.Split(Text1,".") in both cases TempList is empty while it works (for both cases) just fine with any other separator (",",";",etc..). Any reason why "." is not working? thanks
LucaMs Expert Licensed User Longtime User Apr 23, 2021 #2 giggetto71 said: Any reason why "." is not working? Click to expand... I don't know jStringFunctions but usually you have to "escape" special chars, like dot ("."). Regex, for example: Regex.Split("\.", YourVariable) Upvote 0
giggetto71 said: Any reason why "." is not working? Click to expand... I don't know jStringFunctions but usually you have to "escape" special chars, like dot ("."). Regex, for example: Regex.Split("\.", YourVariable)
LucaMs Expert Licensed User Longtime User Apr 23, 2021 #3 BTW where did you get jStringFunction from? I have jStringUtils. EDIT - Here: https://www.b4x.com/android/forum/threads/jstringfunctions-beta.36595/post-215124 Anyway, use Regex. Upvote 0
BTW where did you get jStringFunction from? I have jStringUtils. EDIT - Here: https://www.b4x.com/android/forum/threads/jstringfunctions-beta.36595/post-215124 Anyway, use Regex.
giggetto71 Active Member Licensed User Longtime User Apr 23, 2021 #4 I think it's an old lib. I don't use it (I normally use Regex) I have just tried just to compare and see if for some reasons Regex and StringFunctions were behaving different but they don't. Upvote 0
I think it's an old lib. I don't use it (I normally use Regex) I have just tried just to compare and see if for some reasons Regex and StringFunctions were behaving different but they don't.
MegatenFreak Active Member Licensed User Apr 29, 2021 #5 "." is indeed a special character, and as was already pointed out, it needs to be escaped: "\." Here's a list of common regular expression special characters: Table 9 : List of special characters for regular expression search. Download Table | List of special characters for regular expression search. from publication: Computational Melody Analysis | Computation | ResearchGate, the professional network for scientists. www.researchgate.net Upvote 0
"." is indeed a special character, and as was already pointed out, it needs to be escaped: "\." Here's a list of common regular expression special characters: Table 9 : List of special characters for regular expression search. Download Table | List of special characters for regular expression search. from publication: Computational Melody Analysis | Computation | ResearchGate, the professional network for scientists. www.researchgate.net