String manipulation operations - length, concatenation, search, trimming, case conversion, replacement, splitting, and parsing.
All operations are backed by the Rust runtime.
Returns the byte length of string s.
Returns a new string that concatenates a and b.
Returns true if a and b are equal.
Returns the substring from byte index start (inclusive) to end (exclusive).
Returns the byte index of the first occurrence of needle in s, or -1 if not found.
Returns s with leading and trailing whitespace removed.
Returns s converted to uppercase.
Returns s converted to lowercase.
Returns true if s starts with prefix.
Returns true if s ends with suffix.
Replaces all occurrences of from with to in s.
Returns s repeated count times.
Parses s as a signed decimal integer, returning 0 on failure.
Parses s as a floating-point number, returning 0.0 on failure.
Returns true if s has zero length.
load std.str
let s = "Hello, Nimble!"
let n = str.length(s) # 14
let c = str.concat(s, " World") # "Hello, Nimble! World"
let sub = str.substring(s, 0, 5) # "Hello"
let pos = str.find(s, "Nimble") # 7
let t = str.trim(" spaced ") # "spaced"
let u = str.to_upper(s) # "HELLO, NIMBLE!"
let r = str.replace(s, "!", "?") # "Hello, Nimble?"
let rep = str.repeat("ha", 3) # "hahaha"
let i = str.to_int("42") # 42