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

lengthBytes

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

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.