Skip to content

Graphemes

[Source]

primitive val Graphemes

Constructors

create

[Source]

new val create()
: Graphemes val^

Returns


Public Functions

count

[Source]

Number of extended grapheme clusters in s per UAX #29. Returns InvalidUtf8 if s isn't well-formed UTF-8 — error carries the byte offset of the first ill-formed sequence.

fun box count(
  s: String box)
: (USize val | InvalidUtf8 val)

Parameters

Returns


ranges

[Source]

Iterator over the byte ranges [start, end_exclusive) of each grapheme cluster in s. No per-yield allocation. Returns InvalidUtf8 if s isn't well-formed UTF-8.

fun box ranges(
  s: String box)
: (Iterator[(USize val , USize val)] ref | InvalidUtf8 val)

Parameters

Returns


iter

[Source]

Iterator yielding each grapheme cluster as a String val slice (zero byte-copy; one small String wrapper allocation per yield). Takes String val because the yielded slices share the same val buffer. Returns InvalidUtf8 if s isn't well-formed.

fun box iter(
  s: String val)
: (Iterator[String val] ref | InvalidUtf8 val)

Parameters

Returns


eq

[Source]

fun box eq(
  that: Graphemes val)
: Bool val

Parameters

Returns


ne

[Source]

fun box ne(
  that: Graphemes val)
: Bool val

Parameters

Returns