<@U0AAQKT9Q>?
# getting-started
k
@ilya.gorbunov?
i
I've read several messages above and don't follow what is the question? About dot pattern? About limit parameter of split function?
k
I think @leonardootto Is asking why the meaning of the
limit
parameter in Kotlin differs from its meaning it Java.
Actually it looks like the only difference is that Javas version allows negative values while Kotlins does not.
l
Both api follow the regex implementation from Java. But in kotlin you (?) create this validation: nativePattern.split(input, if (limit == 0) -1 else limit).asList()
And i’m curious why you dont follow the Java behavior. 🙂
@ilya.gorbunov is ilya-g your github user?
1
i
split
from JDK removes empty trailing elements when limit is 0. In Kotlin we've decided to avoid this behavior as unintuitive, so limit=0 in Kotlin behaves as limit=-1 in Java
l
Ok. Do you have more examples of this changes? Unintuitive from Java and changed in Kotlin.
Or a way to me get this infos.
i
This is not a change, Pattern class in Kotlin is the same Pattern as in Java. Regex class on the other hand is a new API and has its own documentation describing its behavior.