std/string
String search, transform, and inspect operations are methods on any string value — no import needed. The character-class helpers below are free functions imported from std/string.
let name = " Alice "
let clean = name.trim().toLower() // "alice"String methods
s.contains
fn contains(self: &string, needle: &string): boolTrue if s contains needle.
s.indexOf / s.lastIndexOf
fn indexOf(self: &string, needle: string): Option<i64>Byte index of the first (last) occurrence of needle; None when it is absent.
s.indexOfFrom
fn indexOfFrom(self: &string, needle: string, from: i64): Option<i64>Like indexOf, but begins searching from byte offset start.
s.startsWith / s.endsWith
fn startsWith(self: &string, prefix: &string): boolTrue if s starts with prefix (ends with suffix).
s.toLower / s.toUpper
fn toLower(self: &string): stringNew string with all ASCII characters lower- (upper-) cased.
s.trim / s.trimStart / s.trimEnd
fn trim(self: &string): stringNew string with whitespace removed from both ends (start, end).
s.split
fn split(self: &string, delimiter: &string): Vec<string>Split by delimiter.
let parts = "a,b,c".split(",") // ["a", "b", "c"]s.splitWords / s.splitWhitespace
fn splitWhitespace(self: &string): Vec<string>Split on runs of ASCII whitespace.
s.replace / s.replaceFirst
fn replace(self: &string, old: &string, new: &string): stringReplace all (or the first) occurrence of old with new.
s.repeat
fn repeat(self: &string, count: i64): strings repeated count times.
s.padStart / s.padEnd
fn padStart(self: &string, targetLen: i64, pad: &string): stringPad to targetLen on the start (end).
Other
s.len(), s.isEmpty(), s.charAt(i), s.reverse(), s.substr(start, end), s.slice(start, end).
Character helpers
from "std/string" import { asciiIsWhitespace, asciiIsDigit, asciiIsAlpha, asciiIsAlphanumeric }Each takes a u8 byte and returns bool: asciiIsWhitespace(c), asciiIsDigit(c), asciiIsAlpha(c), asciiIsAlphanumeric(c).