https://kotlinlang.org logo
Title
m

melston

08/23/2017, 11:08 PM
@leonardootto, the first one splits on any character (the '.' matches any character). The second splits only on an actual dot.
👍 1
k

karelpeeters

08/23/2017, 11:12 PM
@leonardootto See what I mean about crossposting? This is the third time someone answers this exact question.
👍 1
r

robinho

08/24/2017, 1:00 AM
The second splits only on an actual dot
@leonardootto do you have a good example. I try it to understand:
// Kotlin
"My.Text".split(".")
["My", "Text"]

// Kotlin
"My.Text".split(".".toRegex())
[, , , , , , , ] // empty array

// Java
"My.Text".split("[.]")
["My", "Text"]

// Java
"My.Text".split(".")
[]