offsetByCodePoints
Calculates the index of the character that is a specified number of Unicode code points away from the character at the given index in this string.
Any unpaired surrogate chars, for example, appearing when the index is in the middle of a surrogate pair, are counted as one code point each.
Since Kotlin
2.5Return
the index of the character reached by applying the specified code point offset from the given index.
Parameters
the index of the character in this string from which the offset is calculated.
the number of Unicode code points to offset from the character at the specified index. A positive offset moves forward in the string, while a negative offset moves backward.
Throws
if the index is out of the valid range 0..length or there are less than codePointOffset code points in the string starting at the specified index for positive codePointOffset or there are less than -codePointOffset code points in the string before the specified index for negative codePointOffset.
Calculates the index of the character that is a specified number of Unicode code points away from the character at the given index in this char sequence.
Any unpaired surrogate chars, for example, appearing when the index is in the middle of a surrogate pair, are counted as one code point each.
Since Kotlin
2.5Return
the index of the character reached by applying the specified code point offset from the given index.
Parameters
the index of the character in this char sequence from which the offset is calculated.
the number of Unicode code points to offset from the character at the specified index. A positive offset moves forward in the char sequence, while a negative offset moves backward.
Throws
if the index is out of the valid range 0..length or there are less than codePointOffset code points in the string starting at the specified index for positive codePointOffset or there are less than -codePointOffset code points in the string before the specified index for negative codePointOffset.
Calculates the index of the character that is a specified number of Unicode code points away from the character at the given index in the specified range of this 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 are counted, for example, appearing when the index is in the middle of a surrogate pair, are counted as one code point each.
Since Kotlin
2.5Return
the index of the character reached by applying the specified code point offset from the given index.
Parameters
the index of the character in this string from which the offset is calculated.
the number of Unicode code points to offset from the character at the specified index. A positive offset moves forward in the string, while a negative offset moves backward.
The beginning index, inclusive. Defaults to 0.
The ending index, exclusive. Defaults to the size of the char array.
Throws
if the index is out of the valid range startIndex..endIndex or there are less than codePointOffset code points in the string starting at the specified index for positive codePointOffset or there are less than -codePointOffset code points in the string before the specified index for negative codePointOffset.
Calculates the index of the character that is a specified number of Unicode code points away from the character at the given index in this string.
Any unpaired surrogate chars, for example, appearing when the index is in the middle of a surrogate pair, are counted as one code point each.
Since Kotlin
2.5Return
the index of the character reached by applying the specified code point offset from the given index.
Parameters
the index of the character in this string from which the offset is calculated.
the number of Unicode code points to offset from the character at the specified index. A positive offset moves forward in the string, while a negative offset moves backward.
Throws
if the index is out of the valid range 0..length or there are less than codePointOffset code points in the string starting at the specified index for positive codePointOffset or there are less than -codePointOffset code points in the string before the specified index for negative codePointOffset.
Calculates the index of the character that is a specified number of Unicode code points away from the character at the given index in this char sequence.
Any unpaired surrogate chars, for example, appearing when the index is in the middle of a surrogate pair, are counted as one code point each.
Since Kotlin
2.5Return
the index of the character reached by applying the specified code point offset from the given index.
Parameters
the index of the character in this char sequence from which the offset is calculated.
the number of Unicode code points to offset from the character at the specified index. A positive offset moves forward in the char sequence, while a negative offset moves backward.
Throws
if the index is out of the valid range 0..length or there are less than codePointOffset code points in the string starting at the specified index for positive codePointOffset or there are less than -codePointOffset code points in the string before the specified index for negative codePointOffset.
Calculates the index of the character that is a specified number of Unicode code points away from the character at the given index in the specified range of this 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 are counted, for example, appearing when the index is in the middle of a surrogate pair, are counted as one code point each.
Since Kotlin
2.5Return
the index of the character reached by applying the specified code point offset from the given index.
Parameters
the index of the character in this string from which the offset is calculated.
the number of Unicode code points to offset from the character at the specified index. A positive offset moves forward in the string, while a negative offset moves backward.
The beginning index, inclusive. Defaults to 0.
The ending index, exclusive. Defaults to the size of the char array.
Throws
if the index is out of the valid range startIndex..endIndex or there are less than codePointOffset code points in the string starting at the specified index for positive codePointOffset or there are less than -codePointOffset code points in the string before the specified index for negative codePointOffset.