generateStringFromCodePoints

fun generateStringFromCodePoints(size: Int, generator: (Int) -> Int): A_String

Produce an Avail string from the given generator of Unicode code points. Attempt to use a ByteStringDescriptor representation first, but generalize it to a TwoByteStringDescriptor or even a TwentyOneBitStringDescriptor as needed.

Parameters

size

The number of code points that will be in the resulting string, which is also the number of times the generator will be called.

generator

A function that takes a one-based index and produces a code point to write to the string at that index. The indices will be passed in ascending order, from 1 to size.