#string #case #snake #camel #unicode

voca_rs

Voca_rs is a Rust library for manipulating strings. Inspired by Voca.js and string.py

17 releases (stable)

new 1.9.1 Dec 9, 2019
1.8.0 Jul 16, 2019
1.5.0 Mar 24, 2019
1.2.0 Dec 16, 2018
0.5.0 Oct 19, 2018

#53 in Encoding

Download history 41/week @ 2019-08-26 40/week @ 2019-09-02 67/week @ 2019-09-09 167/week @ 2019-09-16 28/week @ 2019-09-23 39/week @ 2019-09-30 6/week @ 2019-10-07 65/week @ 2019-10-14 56/week @ 2019-10-21 20/week @ 2019-10-28 28/week @ 2019-11-04 17/week @ 2019-11-11 35/week @ 2019-11-18 35/week @ 2019-11-25 63/week @ 2019-12-02

193 downloads per month
Used in 2 crates (1 directly)

MIT license

130KB
2K SLoC

voca_rs Build Status Crates version dependency status codecov Codacy Badge license

Voca_rs is a Rust library for manipulating strings.

Voca_rs is inspired by Voca.js, string.py and Inflector

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

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://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

Functions

Case

Chop

Count

Escape

Index

Manipulate

Query

Split

Strip

Utils

Roadmap

  • Possible refactoring: all position indexes covert to zero-based and add a comment to each doc
  • Change all inner arguments to Enums (instead string or bool)
  • To ensure that all regexp expressions are wrapped by lazy_static

Chop

Count

  • countWhere - link
  • count_unique_words - link: Counting occurrences of words using a hash map that stores words and counts

Format

Chop

  • limint_words (from "words") - link
  • deconstantize - link
  • demodulize - link

Manipulate

Copyright

coded by Anatol Marezhanyi @e1r0nd_crg

https://linkedin.com/in/merezhany/
https://www.youtube.com/c/AnatolMerezhanyi

License

Licensed under MIT License

Dependencies

~4MB
~114K SLoC