binary-streams / loggersoft.kotlin.streams / kotlin.String

Extensions for kotlin.String

forCodePoints

Goes through this code points starting from startIndex and with size limit.

fun String.forCodePoints(startIndex: Int = 0, size: Int = -1, block: (index: Int, ch1: Char, ch2: Char, codePoint: Int, isSurrogate: Boolean) -> Boolean): Int

lengthBytes

Calculates bytes required to store this string in specified encoding starting from startIndex and with size limit. If needTerminator is true also place for the last zero character will be counted too.

fun String.lengthBytes(encoding: StringEncoding = StringEncoding.UTF8, startIndex: Int = 0, size: Int = -1, needTerminator: Boolean = true): Int