PHondogo
10/14/2025, 9:47 PMstringValue.substring(0, index) to stringValue.take(index) but those functions are different in case of index > string length: substring will throw StringIndexOutOfBoundsException, take - will return original string.bod
10/15/2025, 6:59 AMPHondogo
10/15/2025, 7:25 AMbod
10/15/2025, 7:30 AMPHondogo
10/15/2025, 8:02 AMval s = try {
"abcd".substring(0, 10) // suggestion to change to take fun is incorrect and it would change semantics
} catch (_: StringIndexOutOfBoundsException) {
"outOfBounds"
}
println(s)bod
10/15/2025, 8:24 AMPHondogo
10/15/2025, 8:25 AMbod
10/15/2025, 8:25 AMloke
10/21/2025, 3:30 PMtake could easily hide errors.