Voca_rs is a Rust library for manipulating [unicode] strings.
Voca_rs is inspired by Voca.js (JavaScript), string.py (Python), Inflector (Rust), and Grafite (PHP).
Voca_rs is implemented on Foreign Types, i.e. String
and str
. Respects Unicode.
Using functions:
```rust use voca_rs::*;
let inputstring = "LazyLoad with XMLHttpRequest and snakecase"; let stringinwords = split::words(&inputstring); // => ["Lazy", "Load", "with", "XML", "Http", "Request", "and", "snake", "case"] let wordsinstring = &stringinwords.join(" "); // => "Lazy Load with XML Http Request and snake case" let truncatedstring = chop::prune(&wordsinstring, 21, ""); // => "Lazy Load with XML..." let slicedstring = chop::slice(&truncatedstring, 5, -2); // => "Load with XML." let snakedstring = case::snakecase(&slicedstring); // => "loadwith_xml" ```
Using traits (all methods start from the underscore symbol):
```rust use voca_rs::Voca;
"LazyLoad with XMLHttpRequest and snakecase" .words() // => ["Lazy", "Load", "with", "XML", "Http", "Request", "and", "snake", "case"] .join(" ") // => "Lazy Load with XML Http Request and snake case" .prune(21, "") // => "Lazy Load with XML..." .slice(5, -2) // => "Load with XML." .snakecase(); // => "loadwithxml" ```
See the complete documentation at https://e1r0nd.github.io/voca_rs/
Run tests: cargo test
Build docs: cargo doc
-> ./target/doc/voca_rs/index.html
Build a project: cargo build
-> ./target/debug
position
indexes covert to zero-based and add a comment to each docstring
or bool
)lazy_static
coded by Anatol Marezhanyi @e1r0nd_crg
https://linkedin.com/in/merezhany/
https://www.youtube.com/c/AnatolMerezhanyi
Licensed under MIT License