Skip to content

Search

[Source]

primitive val Search

Constructors

create

[Source]

new val create()
: Search val^

Returns


Public Functions

contains

[Source]

True iff haystack contains needle as a contiguous byte subsequence. Empty needle is always contained (returns true).

fun box contains(
  haystack: String box,
  needle: String box)
: (Bool val | InvalidUtf8 val)

Parameters

Returns


starts_with

[Source]

True iff haystack begins with prefix.

fun box starts_with(
  haystack: String box,
  prefix: String box)
: (Bool val | InvalidUtf8 val)

Parameters

Returns


ends_with

[Source]

True iff haystack ends with suffix.

fun box ends_with(
  haystack: String box,
  suffix: String box)
: (Bool val | InvalidUtf8 val)

Parameters

Returns


index_of

[Source]

Byte offset of the first occurrence of needle, or None if absent. Empty needle returns 0.

fun box index_of(
  haystack: String box,
  needle: String box)
: (USize val | None val | InvalidUtf8 val)

Parameters

Returns


last_index_of

[Source]

Byte offset of the last occurrence of needle, or None.

fun box last_index_of(
  haystack: String box,
  needle: String box)
: (USize val | None val | InvalidUtf8 val)

Parameters

Returns


count

[Source]

Non-overlapping occurrences of needle in haystack.

fun box count(
  haystack: String box,
  needle: String box)
: (USize val | InvalidUtf8 val)

Parameters

Returns


eq

[Source]

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

Parameters

Returns


ne

[Source]

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

Parameters

Returns