codePointCount

expect fun String.codePointCount(startIndex: Int = 0, endIndex: Int = this.length): Int(source)

Counts the number of Unicode code points in the specified range of the string.

The range is defined by the startIndex (inclusive) and endIndex (exclusive) parameters. By default, the entire string is considered.

Any unpaired surrogate chars, for example, appearing when startIndex or endIndex fall into the middle of a surrogate pair, are counted as one code point each.

Since Kotlin

2.5

Return

The number of Unicode code points in the specified range.

Parameters

startIndex

The beginning index, inclusive. Defaults to 0.

endIndex

The ending index, exclusive. Defaults to the length of the string.

Throws

If startIndex or endIndex is out of the valid range 0..length or endIndex < startIndex.


expect fun CharSequence.codePointCount(startIndex: Int = 0, endIndex: Int = this.length): Int(source)

Counts the number of Unicode code points in the specified range of the char sequence.

The range is defined by the startIndex (inclusive) and endIndex (exclusive) parameters. By default, the entire char sequence is considered.

Any unpaired surrogate chars, for example, appearing when startIndex or endIndex fall into the middle of a surrogate pair, are counted as one code point each.

Since Kotlin

2.5

Return

The number of Unicode code points in the specified range.

Parameters

startIndex

The beginning index, inclusive. Defaults to 0.

endIndex

The ending index, exclusive. Defaults to the length of the char sequence.

Throws

If startIndex or endIndex is out of the valid range 0..length or endIndex < startIndex.


expect fun CharArray.codePointCount(startIndex: Int = 0, endIndex: Int = this.size): Int(source)

Counts the number of Unicode code points in the specified range of the char array.

The range is defined by the startIndex (inclusive) and endIndex (exclusive) parameters. By default, the entire char array is considered.

Any unpaired surrogate chars, for example, appearing when startIndex or endIndex fall into the middle of a surrogate pair, are counted as one code point each.

Since Kotlin

2.5

Return

The number of Unicode code points in the specified range.

Parameters

startIndex

The beginning index, inclusive. Defaults to 0.

endIndex

The ending index, exclusive. Defaults to the size of the char array.

Throws

If startIndex or endIndex is out of the valid range 0..size or endIndex < startIndex.

actual inline fun String.codePointCount(startIndex: Int, endIndex: Int): Int(source)

Counts the number of Unicode code points in the specified range of the string.

The range is defined by the startIndex (inclusive) and endIndex (exclusive) parameters. By default, the entire string is considered.

Any unpaired surrogate chars, for example, appearing when startIndex or endIndex fall into the middle of a surrogate pair, are counted as one code point each.

Since Kotlin

2.5

Return

The number of Unicode code points in the specified range.

Parameters

startIndex

The beginning index, inclusive. Defaults to 0.

endIndex

The ending index, exclusive. Defaults to the length of the string.

Throws

If startIndex or endIndex is out of the valid range 0..length or endIndex < startIndex.


actual inline fun CharSequence.codePointCount(startIndex: Int, endIndex: Int): Int(source)

Counts the number of Unicode code points in the specified range of the char sequence.

The range is defined by the startIndex (inclusive) and endIndex (exclusive) parameters. By default, the entire char sequence is considered.

Any unpaired surrogate chars, for example, appearing when startIndex or endIndex fall into the middle of a surrogate pair, are counted as one code point each.

Since Kotlin

2.5

Return

The number of Unicode code points in the specified range.

Parameters

startIndex

The beginning index, inclusive. Defaults to 0.

endIndex

The ending index, exclusive. Defaults to the length of the char sequence.

Throws

If startIndex or endIndex is out of the valid range 0..length or endIndex < startIndex.


actual fun CharArray.codePointCount(startIndex: Int, endIndex: Int): Int(source)

Counts the number of Unicode code points in the specified range of the char array.

The range is defined by the startIndex (inclusive) and endIndex (exclusive) parameters. By default, the entire char array is considered.

Any unpaired surrogate chars, for example, appearing when startIndex or endIndex fall into the middle of a surrogate pair, are counted as one code point each.

Since Kotlin

2.5

Return

The number of Unicode code points in the specified range.

Parameters

startIndex

The beginning index, inclusive. Defaults to 0.

endIndex

The ending index, exclusive. Defaults to the size of the char array.

Throws

If startIndex or endIndex is out of the valid range 0..size or endIndex < startIndex.