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
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.
"." 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:
Download Table | List of special characters for regular expression search. from publication: Computational Melody Analysis | Computation | ResearchGate, the professional network for scientists.