B4J Question strange issue with split (both string functions and Regex) and "." as separator

giggetto71

Active Member
Licensed User
Longtime User
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
 

giggetto71

Active Member
Licensed User
Longtime User
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

MegatenFreak

Active Member
Licensed User
"." 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:
 
Upvote 0
Top