Rust's str module in TypeScript
- contains
- ends_with
- find
- len
- lines
- match_indices
- replace
- rfind
- rsplit_once
- rsplit_terminator
- rsplitn
- split_inclusive
- split_once
- split_terminator
- splitn
- starts_with
- strip_prefix
- strip_suffix
- to_lowercase
- to_uppercase
- trim
- trim_end
- trim_start
We have 23 Rust functions so far - help us add more
Got a rainy Sunday afternoon and a taste for a porting puzzle?
- Get inspiration from the Rust std::str docs.
- Click "New file" in the appropriate folder on GitHub. This will fork the project to your account, directly add the file to it, and send a Pull Request to us.
We will then review it. If it's useful to the project and in line with our contributing guidelines your work will become part of Locutus and you'll be automatically credited in the authors section accordingly.
Upstream Surface Inventory 23/34 shipped • 3 next 68%
Namespace-level inventory for Rust 1.85: what we already ship, what we may still want,
and what we intentionally skip or keep.
str primitive methods
88%
shipped
23/26 shipped
3 next
8 explicit non-goals
Shipped (23)
Next
Remaining string helpers are useful plain-value portability targets unless they depend on iterators or byte semantics.
is_asciirepeatsplit_ascii_whitespace
Explicit non-goals (8)
-
bytesByte iterators do not fit Locutus' current plain-value model. -
char_indicesIterator-returning APIs do not fit Locutus' plain-value model. -
charsIterator-returning APIs do not fit Locutus' plain-value model. -
matchesIterator-returning APIs do not fit Locutus' plain-value model. -
parseGeneric trait-driven parsing does not map cleanly to JS plain values. -
rmatch_indicesIterator-returning APIs do not fit Locutus' plain-value model. -
rmatchesIterator-returning APIs do not fit Locutus' plain-value model. -
trim_matchesPattern-driven trimming does not map cleanly to one stable plain-value contract.