| Crates.io | string-mumu |
| lib.rs | string-mumu |
| version | 0.2.0-rc.2 |
| created_at | 2025-07-09 06:24:52.463849+00 |
| updated_at | 2025-10-07 15:28:57.932635+00 |
| description | String functions and tools plugin for the Lava / Mumu language |
| homepage | https://lava.nu11.uk |
| repository | https://gitlab.com/tofo/mumu-string |
| max_upload_size | |
| id | 1744283 |
| size | 139,224 |
A MuMu/Lava plugin to provide fast, Unicode-aware string tools with friendly currying and data-last ergonomics.
Repository: https://gitlab.com/tofo/string-mumu
License: MIT OR Apache-2.0
Engine compatibility: core-mumu = 0.9.0-rc.3 (host and wasm builds)
string:* functions to MuMu/Lava_) and data-last calling stylesThe plugin registers all symbols via register_all(interp). On native builds it also exports a dynamic entrypoint Cargo_lock(...) so extend("string") can load it at runtime.
string:lower(s) — to lowercasestring:upper(s) — to uppercasestring:length(s) — to return character countstring:trim(s) / string:trim_start(s) / string:trim_end(s)string:to_string(v) — to stringify any MuMu Value (arrays, objects, refs, etc.)All unary functions are curry-able and accept _ as a placeholder.
string:multi(...args) — to concatenate any number of values after string-coercionstring:concat(a, b) — to concatenate two strings (curry-able)string:contains(s, pat) — to test substringstring:starts_with(prefix, s) / string:ends_with(suffix, s) — data-laststring:index_of(s, pat) / string:last_index_of(s, pat) — to return character index or -1string:search(pat, s) — to return first match index or -1 (supports regex)string:slice(s, start, end) — to slice by character offsets (supports negatives)string:substring(start, end, s) — to use JS-style semantics (clamp/swap; negatives → 0)string:at(index, s) — to get the character at index (negatives from end) or return _string:code_point_at(index, s) — to return the Unicode code point (int) or _string:pad_start(len, pad, s) / string:pad_end(len, pad, s) — data-last; pad defaults to spacestring:repeat(s, n)string:split(sep, s) — to return StrArraystring:join(sep, arr) — to join, accepting empty arrays of any element typestring:replace(s, from, to) — to replace all non-overlapping occurrencesstring:replace_all(pat, repl, s) — to replace with string or regex patternstring:replace_fn(pat, repl, s) — to accept string or regex; function replacers are intentionally unsupported in this build (use string:replace_all instead)string:match(pat, s) — to return the first match (capturing groups) or _string:match_all(pat, s) — to return a MixedArray of match arrays (supports regex)string:to_locale_lower(locale, s) / string:to_locale_upper(locale, s) — locale parameter accepted for forward-compat (current build uses Unicode case maps)string:locale_compare(other, options, s) — to compare with optional { sensitivity: "base" | "case" | "accent" | "variant" }string:normalize(form, s) — to accept "NFC" | "NFD" | "NFKC" | "NFKD"; current build returns s unchanged (ICU-backed normalization can be wired later)All multi-arg functions support:
currying with _ placeholders:
extend("string")
has_http = string:starts_with("http")
has_http("https://lava.nu11.uk") // true
data-last ergonomics for many functions (starts_with, ends_with, substring, pad_*, to_locale_*, locale_compare, etc.):
string:substring(2, 5, "mumu") // "mu"
Unicode-safe indexing by character (not byte):
string:at(-1, "naïve") // "e"
Return conventions
_index_of, search): returns -1match, match_all): returns _ or empty list accordinglyStrArray(["..."]).string:to_string(v) pretty-prints MuMu values:
{ k: v, ... }string:multi(...) applies the same stringification per argument and concatenates.extend("string")
string:lower("MuMu") // "mumu"
string:contains("MuMu language", "Mu") // true
string:index_of("banana", "na") // 2
string:slice("abcdef", 2, -1) // "cde"
string:join(", ", ["a", "b", "c"]) // "a, b, c"
// Currying & placeholders
greet = string:concat("hi ", _)
greet("Guru") // "hi Guru"
// Regex
rx = /na+/i
string:match(rx, "BAnAna") // ["Ana"]
string:match_all(rx, "banana") // [["na"], ["na"]]
chars() counts; all index math uses character lengthextend("string")) via Cargo_lock symbolwasm feature; host-only deps are gatedrepeat count)string:normalize currently acknowledges forms but returns the input unchanged (ICU hooks can be added).string:replace_fn rejects function replacers in this build; prefer string:replace_all.locale or options object but default to standard Unicode case/compare in this crate.Issues and merge requests are welcome at:
https://gitlab.com/tofo/string-mumu
Please align changes with the MuMu core conventions:
"string:<fn> => ...")Licensed under either of:
at your option.