Skip to content

Words

[Source]

primitive val Words

Constructors

create

[Source]

new val create()
: Words val^

Returns


Public Functions

count

[Source]

Number of UAX #29 word segments in s. A "word segment" here is any boundary-delimited run — letters, numerics, and punctuation all count, since UAX #29 defines boundaries rather than "wordness". Use the test Words.iter and filter to letters/ numerics yourself if you want only words-as-text.

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

Parameters

Returns


ranges

[Source]

Iterator over byte ranges [start, end_exclusive) of each word segment. Zero per-yield allocation.

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

Parameters

Returns


iter

[Source]

Iterator yielding each word segment as a String val slice (zero byte-copy). Takes String val because the yielded slices share the same val buffer.

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

Parameters

Returns


eq

[Source]

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

Parameters

Returns


ne

[Source]

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

Parameters

Returns