Android Question Regex.Split strange behaviour with dots

Straker

Active Member
Licensed User
Longtime User
This is my first post, I bought B4A just a couple of days ago and I'm currently learning the language. Probably my question is just sill... be patient.

This code doesn't work
B4X:
dim ipAddr as string, l() as string
ipAddr = "192.0.0.55"

l = regex.split(".", ipAddr)
Log(l.length)  '<-- returns 0 (which is wrong)

Ok, I've found a workaround with:
B4X:
dim ipAddr as string, l() as string
ipAdd = "192.0.0.55"

l = regex.split(",", ipAddr.Replace(".", ","))
Log(l.length)  '<-- returns 4 (CORRECT)

The question is: why the first code doesn't work?
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…