Strings and bytes
Str holds text. Double quotes enable expression interpolation; single quotes keep braces literal. Both forms process escape sequences.
let name = "Ada"print("hello, {name}") # hello, Adaprint('hello, {name}') # hello, {name}print("six times seven: {6 * 7}")Common escapes include \n, \t, \r, \\, \', and \". In an interpolated string, \{ and \} produce literal braces. Unicode escapes use four digits with \uNNNN or eight with \UNNNNNNNN.
Transform text
Section titled “Transform text”let text = " Small Steps "let clean = text.trim().to_lower()print(clean) # small stepsprint(clean.contains("steps")) # trueprint(clean.replace("small", "steady"))Other methods include starts_with, ends_with, trim_start, trim_end, and to_upper.
split(delimiter) returns an Arr[Str]:
let names = "Ada,Lin,Sam".split(",")for name in names { print(name)}An empty delimiter splits into individual codepoint strings with empty parts at both boundaries. The word-frequency tutorial combines normalization, splitting, and counting.
Unicode is counted in codepoints
Section titled “Unicode is counted in codepoints”let word = "héllo"print(word.len()) # 5print(word.substr(1, 1)) # éprint(word.to_bin().len()) # 6 UTF-8 bytessubstr(start, length) uses codepoint positions. A displayed character can contain multiple codepoints, so these operations are not grapheme-cluster indexing.
chars() returns Arr[Char]. Single quotes still produce a Str; they are not a character-literal syntax.
Bytes are separate
Section titled “Bytes are separate”let packet = b'hi\xff'print(typeof(packet)) # Binprint(packet.len()) # 3b"..." supports interpolation; b'...' does not. In byte strings, \xNN contributes one raw byte. Str.to_bin() encodes text as UTF-8. This distinction keeps binary data separate from text.
Numeric conversion can stop execution
Section titled “Numeric conversion can stop execution”"42".to_int() and "3.5".to_float() convert valid text. Invalid input currently produces a runtime error; these methods do not return Res. Adding ? does not catch that failure. Use explicit validation and a result-returning API when designing your own operations.