Kotlin Split lines Online
Split text into lines with optional line endings.
Run details
The output updates as you type. The tool processes input in your browser.
Worked example
Keep line endings to inspect the separators as well as the text. One final line ending does not create an additional empty entry.
- Keep line endings
false
line1 line2 line3
[ "line1", "line2", "line3" ]
Using this operation in Kotlin
The interactive result uses JavaScript. Kotlin String APIs expose character indexes and case conversion. Check whether your code targets JVM, JS, Native, or Wasm when depending on platform-specific utilities.