utfLength

context(env: JniEnv)
val JString.utfLength: Int(source)

The length in bytes of the modified UTF-8 representation of a string.

Since JDK 24:

As the capacity of a Int variable is not sufficient to hold the length of all possible modified UTF-8 string representations (due to multibyte encodings), this is deprecated in favor of utfLengthLong.

If the modified UTF-8 representation of string has a length that exceeds the capacity of a Int variable, then this returns the number of bytes up to and including the last character that could be fully encoded without exceeding that capacity.