Crate voca_rs[−][src]
Expand description
Voca_rs is the ultimate Rust string library inspired by Voca.js and string.py
Using functions:
use voca_rs::*;
let input_string = "LazyLoad with XMLHttpRequest and snake_case";
let string_in_words = split::words(&input_string);
// => ["Lazy", "Load", "with", "XML", "Http", "Request", "and", "snake", "case"]
let words_in_string = &string_in_words.join(" ");
// => "Lazy Load with XML Http Request and snake case"
let truncated_string = chop::prune(&words_in_string, 21, "");
// => "Lazy Load with XML..."
let sliced_string = chop::slice(&truncated_string, 5, -2);
// => "Load with XML."
let snaked_string = case::snake_case(&sliced_string);
// => "load_with_xml"
Using traits (all methods start from the underscore symbol):
use voca_rs::Voca;
"LazyLoad with XMLHttpRequest and snake_case"
._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."
._snake_case();
// => "load_with_xml"
Modules
Converts the subject
to a selected case.
Extracts a character(s) from subject
.
Counts the characters in subject
.
Escapes special characters in subject
.
Returns the index of search
in subject
.
Manipulate with the subject
.
Checks a subject
against a query.
Splits subject
into an chuncks according to given rules.
Strips specific characters from subject.
Utility functions and properties.