#snake-case #string #unicode #case #snake #camel

voca_rs

Voca_rs is a Rust library for manipulating [unicode] strings

22 stable releases

Uses old Rust 2015

1.15.2 Nov 10, 2022
1.15.0 Oct 1, 2022
1.14.0 Sep 18, 2021
1.13.0 Oct 4, 2020
0.5.0 Oct 19, 2018

#191 in Encoding

Download history 1682/week @ 2024-09-12 1566/week @ 2024-09-19 1956/week @ 2024-09-26 2382/week @ 2024-10-03 1634/week @ 2024-10-10 1733/week @ 2024-10-17 2092/week @ 2024-10-24 2047/week @ 2024-10-31 2390/week @ 2024-11-07 1625/week @ 2024-11-14 1952/week @ 2024-11-21 3142/week @ 2024-11-28 3189/week @ 2024-12-05 2345/week @ 2024-12-12 1586/week @ 2024-12-19 482/week @ 2024-12-26

8,560 downloads per month
Used in 31 crates (21 directly)

MIT license

2MB
68K SLoC

voca_rs

Crates version dependency status Build Status codecov license

Voca_rs is a Rust library for manipulating [unicode] strings.

Voca_rs is implemented on Foreign Types, i.e. String and str. Respects Unicode.

Voca_rs is inspired by Voca.js (JavaScript), string.py (Python), Inflector (Rust), and Grafite (PHP).

TL;DR

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"

Documentation

See the complete documentation at https://docs.rs/voca_rs/

Run tests: cargo test
Build docs: cargo doc -> ./target/doc/voca_rs/index.html
Build a project: cargo build -> ./target/debug

Functions

Case

Chop

Count

Escape

Index

Manipulate

Query

Split

Strip

Utils

Coded by A. Merezhanyi

License

Licensed under MIT License

Dependencies

~2.5–3.5MB
~59K SLoC