elect
09/24/2020, 8:53 AMString.getOrNul(index: Int): Char
where nul
is \u0000
edrd
09/24/2020, 1:34 PMgetOrNull(index) ?: "\u0000"
?
Makes it much clearer what is going on. No need for a function on the stdlib.elect
09/24/2020, 1:35 PMedrd
09/24/2020, 1:35 PMelect
09/24/2020, 1:36 PMedrd
09/24/2020, 1:37 PMelect
09/24/2020, 1:37 PMedrd
09/24/2020, 1:38 PMelect
09/24/2020, 1:40 PMgildor
09/25/2020, 5:54 AMgildor
09/25/2020, 6:18 AMmiha-x64
09/25/2020, 12:58 PMChar
and most of functions accepting or returning it are useless and should be deprecated.elect
09/25/2020, 1:00 PMelect
09/25/2020, 1:00 PMdiesieben07
09/25/2020, 1:02 PMInt
(an inline class
for those would be nice in the stdlib though maybe).elect
09/25/2020, 1:03 PMdiesieben07
09/25/2020, 1:03 PMjava.lang.String
already provides an API to deal with code points.elect
09/25/2020, 1:12 PMInt
essentially means utf32elect
09/25/2020, 1:12 PMelect
09/25/2020, 1:13 PMdiesieben07
09/25/2020, 1:13 PMIntArray
, which would be utf32. What I am saying is that when working with a String
object you shouldn't have to deal with the intricacies of the underlying storage format.elect
09/25/2020, 1:15 PMdiesieben07
09/25/2020, 1:17 PMsomeString.length
should be the number of code points, not the number of utf 16 chars. its the same issue you have in languages that represent strings as byte arrays, where you now have to deal with the byte lenght of a string in utf-8 instead of its actual length.Marc Knaup
10/02/2020, 2:55 PM