String module

begins_with

procedure · 1 overloadSource

Whether s starts with prefix. An empty prefix always matches.

begins_with :: (s: string, prefix: string) -> bool

Parameters

s: string
prefix: string

Returns

bool
ExampleOpen in playground ↗
assert(begins_with("filename.txt", "file"));
assert(!begins_with("file", "filename"));

See also