SurrogateIndexConverter

class SurrogateIndexConverter(string: String)

A construct for mapping indices within Avail strings, which can contain code points up to 0x10FFFF, to and from indices in the corresponding Java strings, which must use two UTF-16 code points (a surrogate pair) for any character above 0xFFFF.

Constructors

Link copied to clipboard
fun SurrogateIndexConverter(string: String)

Functions

Link copied to clipboard
fun availIndexToJavaIndex(availZeroIndex: Int): Int

Convert from a zero-based index into the Avail string, where code points can be up to 0x10FFFF, to a zero-based index into the Java string that would have to use surrogate pairs (two Chars) per code point over 0xFFFF. The resulting index will be greater than or equal to the Avail index, depending how many large code points occur prior to the given index.

Link copied to clipboard
fun javaIndexToAvailIndex(javaZeroIndex: Int): Int

Convert from a zero-based index into a Java string, which contains only code points in 0..0xFFFF, using two to represent Unicode values in 0x10000-0x10FFFF, into zero-based index into an Avail string, which can contain arbitrary code points.

Properties

Link copied to clipboard
val highCodePointsInAvailString: IntArray
Link copied to clipboard
val highSurrogatesInJavaString: IntArray