Stephan Schroeder
04/15/2021, 8:39 AMfun String.indexOfOrNull(s: String): UInt?
including UInt versions of substring
, etc.Michael Böiers
04/15/2021, 8:49 AMupperCase
method are still annotated as experimental …toUpperCase
) are already annotated as deprecated.Stephan Schroeder
04/15/2021, 9:18 AMfun String.indexOfOrNull(s: String): UInt?
including UInt versions of substring
, etc.operator fun <T> Array<T>.get(index: UInt): T {
val indexAsInt = index.toInt()
require(indexAsInt>=0) {"index isn't allowed to be bigger than Int.MAX_VALUE ($Int.MAX_VALUE}), but is: $index"}
return this[indexAsInt]
}
has two issues:
• the implementation will still finally check if the index is at least 0
• I'm still limited by Int.MAX_VALUE as Array lengthColton Idle
04/15/2021, 9:33 AMMichael Böiers
04/15/2021, 9:45 AMtodd.ginsberg
04/15/2021, 1:07 PMMichael Böiers
04/15/2021, 1:39 PMrocketraman
04/15/2021, 4:47 PMInt.MAX_VALUE
is much smaller than UInt.MAX_VALUE
.elizarov
04/15/2021, 5:21 PMMichael Böiers
04/15/2021, 8:46 PMelizarov
04/16/2021, 5:50 AMMichael Böiers
04/16/2021, 6:34 AMelizarov
04/16/2021, 6:39 AMMichael Böiers
04/16/2021, 6:48 AMtodd.ginsberg
04/17/2021, 4:07 PMianbrandt
04/20/2021, 5:15 PMelizarov
04/26/2021, 12:18 PMdelay
. Unsigned types are designed for storage of values that need to utilize all the available bits for non-negative values.