Coder Social home page Coder Social logo

a-merezhanyi / voca_rs Goto Github PK

View Code? Open in Web Editor NEW
182.0 7.0 11.0 3.65 MB

Voca_rs is the ultimate Rust [unicode] string library, implemented as independent functions and on Foreign Types (String and str).

Home Page: https://crates.io/crates/voca_rs

License: Other

Rust 100.00%
string rust utf-8 utf8 string-manipulation string-matching string-formatter unicode

voca_rs's Introduction

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

Copyright

Coded by A. Merezhanyi

License

Licensed under MIT License

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.