Surrogate Index Converter
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
Functions
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.
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.