Skip to main content

Module string

Module string 

Source
Expand description

Extended string operations (Unicode-aware).

Complements Lua’s built-in string library with operations that are either missing or only ASCII-aware in standard Lua.

local str = std.string
str.trim("  hello  ")            --> "hello"
str.split("a,b,c", ",")          --> {"a", "b", "c"}
str.starts_with("hello", "he")   --> true
str.replace("abab", "ab", "x")   --> "xab"
str.replace_all("abab", "ab", "x") --> "xx"
str.upper("café")                --> "CAFÉ"
str.pad_start("42", 5, "0")      --> "00042"

Functions§

module