All Projects → whatisinternet → Inflector

whatisinternet / Inflector

Licence: bsd-2-clause
A rust inflection library

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Inflector

Underscore.string.java
String manipulation operations in java
Stars: ✭ 6 (-93.18%)
Mutual labels:  string-manipulation
Shell Functools
Functional programming tools for the shell
Stars: ✭ 971 (+1003.41%)
Mutual labels:  string-manipulation
Beta
An open source reimplementation of Benny Brodda's BETA in Python
Stars: ✭ 65 (-26.14%)
Mutual labels:  string-manipulation
Rusticsom
Rust library for Self Organising Maps (SOM).
Stars: ✭ 18 (-79.55%)
Mutual labels:  crates
Mightystring
Making Ruby Strings Powerful
Stars: ✭ 28 (-68.18%)
Mutual labels:  string-manipulation
Cracking The Coding Interview
Solutions for Cracking the Coding Interview - 6th Edition
Stars: ✭ 35 (-60.23%)
Mutual labels:  string-manipulation
Go Pretty
Pretty print tables and more in golang!
Stars: ✭ 777 (+782.95%)
Mutual labels:  string-manipulation
Accord
Data validation library for Rust
Stars: ✭ 72 (-18.18%)
Mutual labels:  crates
Rust Multibase
Multibase in rust
Stars: ✭ 30 (-65.91%)
Mutual labels:  crates
Litestringbuilder
Alternative to the System.Text.StringBuilder C# class.
Stars: ✭ 48 (-45.45%)
Mutual labels:  string-manipulation
Chr
🔤 Lightweight R package for manipulating [string] characters
Stars: ✭ 18 (-79.55%)
Mutual labels:  string-manipulation
Stringplus
Funny and minimal string library for C++ inspired by underscore.string
Stars: ✭ 7 (-92.05%)
Mutual labels:  string-manipulation
Rust Skiplist
Skiplist implementation in rust
Stars: ✭ 38 (-56.82%)
Mutual labels:  crates
Tantivy Jieba
An adapter that bridges between tantivy and jieba-rs.
Stars: ✭ 17 (-80.68%)
Mutual labels:  crates
Half Rs
Half-precision floating point types f16 and bf16 for Rust.
Stars: ✭ 68 (-22.73%)
Mutual labels:  crates
Ritual
Use C++ libraries from Rust
Stars: ✭ 792 (+800%)
Mutual labels:  crates
Syntect
Rust library for syntax highlighting using Sublime Text syntax definitions.
Stars: ✭ 972 (+1004.55%)
Mutual labels:  crates
Crates Io Cli
Interact with crates.io from the command-line
Stars: ✭ 82 (-6.82%)
Mutual labels:  crates
Left Pad
⬅️ String left pad -- deprecated, use String​.prototype​.pad​Start()
Stars: ✭ 1,179 (+1239.77%)
Mutual labels:  string-manipulation
Str Helper
⚡️ A flexible & powerful string manipulation helper for PHP | using pipe method chaining
Stars: ✭ 40 (-54.55%)
Mutual labels:  string-manipulation

Rust Inflector

Build Status Crates.ioCrate downloads

Adds String based inflections for Rust. Snake, kebab, train, camel, sentence, class, and title cases as well as ordinalize, deordinalize, demodulize, deconstantize, foreign key, table case, and pluralize/singularize are supported as both traits and pure functions acting on &str and String types.


Documentation:

Documentation can be found here at the README or via rust docs below.

Rust docs with examples


Installation:

As a crate

[dependencies]
Inflector = "*"

Compile yourself:

  1. Install Rust and cargo
  2. git clone https://github.com/whatisinternet/Inflector
  3. Library: cd inflector && cargo build --release --lib
  4. You can find the library in target/release

Usage / Example:

...
// to use methods like String.to_lower_case();
extern crate inflector;
use inflector::Inflector;
...
fn main() {
...
  let camel_case_string: String = "some_string".to_camel_case();
...
}

Or

...
// to use methods like to_snake_case(&str);
extern crate inflector;

// use inflector::cases::classcase::to_class_case;
// use inflector::cases::classcase::is_class_case;

// use inflector::cases::camelcase::to_camel_case;
// use inflector::cases::camelcase::is_camel_case;

// use inflector::cases::pascalcase::to_pascal_case;
// use inflector::cases::pascalcase::is_pascal_case;

// use inflector::cases::screamingsnakecase::to_screamingsnake_case;
// use inflector::cases::screamingsnakecase::is_screamingsnake_case;

// use inflector::cases::snakecase::to_snake_case;
// use inflector::cases::snakecase::is_snake_case;

// use inflector::cases::kebabcase::to_kebab_case;
// use inflector::cases::kebabcase::is_kebab_case;

// use inflector::cases::traincase::to_train_case;
// use inflector::cases::traincase::is_train_case;

// use inflector::cases::sentencecase::to_sentence_case;
// use inflector::cases::sentencecase::is_sentence_case;

// use inflector::cases::titlecase::to_title_case;
// use inflector::cases::titlecase::is_title_case;

// use inflector::cases::tablecase::to_table_case;
// use inflector::cases::tablecase::is_table_case;

// use inflector::numbers::ordinalize::ordinalize;
// use inflector::numbers::deordinalize::deordinalize;

// use inflector::suffix::foreignkey::to_foreign_key;
// use inflector::suffix::foreignkey::is_foreign_key;

// use inflector::string::demodulize::demodulize;
// use inflector::string::deconstantize::deconstantize;

// use inflector::string::pluralize::to_plural;
// use inflector::string::singularize::to_singular;
...
fn main() {
...
  let camel_case_string: String = to_camel_case("some_string");
...
}

Advanced installation and usage:

If the project doesn't require singularize, pluralize, class, table, demodulize, deconstantize. Then in your cargo.toml you may wish to specify:

[dependencies.Inflector]
version = "*"
default-features = false

Or

Inflector = {version="*", default-features=false}

To test this crate locally with features off try:

cargo test --no-default-features

Contributing

This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].