百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
V

voca_rs

> 数据库
开源

Voca_rs 是一个完美的 Rust [unicode] 字符串库,它以独立的函数和外部类型 (String 和 str) 实现。

185 stars0 点赞3 次浏览
访问官网GitHub

工具介绍

Voca_rs 是一个完美的 Rust [unicode] 字符串库,它以独立的函数和外部类型 (String 和 str) 实现。

voca_rs

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:

rust
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):

rust
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

Run tests: cargo test

Build docs: cargo doc -> ./target/doc/voca_rs/index.html

Build a project: cargo build -> ./target/debug

Functions

Case

  • camel_case
  • capitalize
  • decapitalize
  • kebab_case
  • lower_case
  • lower_first
  • pascal_case
  • shouty_kebab_case
  • shouty_snake_case
  • snake_case
  • swap_case
  • title_case
  • train_case
  • upper_case
  • upper_first

Chop

  • after
  • after_last
  • before
  • before_last
  • char_at
  • code_point_at
  • first
  • foreign_key
  • grapheme_at
  • last
  • limit_words
  • max
  • min
  • prune
  • removeprefix
  • removesuffix
  • slice
  • substr
  • substring
  • truncate

Count

  • count
  • count_graphemes
  • count_substrings
  • count_unique_words
  • count_where
  • count_words

Escape

  • escape_html
  • escape_regexp
  • unescape_html

Index

  • index_all
  • index_of
  • last_index_of
  • search

Manipulate

  • expand_spaces
  • expand_tabs
  • finish
  • insert
  • latinise
  • pad
  • pad_left
  • pad_right
  • repeat
  • replace
  • replace_all
  • reverse
  • reverse_grapheme
  • slugify
  • splice
  • start
  • tr
  • trim
  • trim_left
  • trim_right
  • word_wrap
  • zfill

Query

  • ends_with
  • includes
  • is_alpha
  • is_alphadigit
  • is_blank
  • is_camel_case
  • is_capitalize
  • is_decapitalize
  • is_digit
  • is_empty
  • is_foreign_key
  • is_lowercase
  • is_lower_first
  • is_kebab_case
  • is_shouty_kebab_case
  • is_numeric
  • is_pascal_case
  • is_snake_case
  • is_shouty_snake_case
  • is_title
  • is_train_case
  • is_uppercase
  • is_upper_first
  • matches
  • query
  • starts_with

Split

  • chars
  • code_points
  • graphemes
  • split
  • words

Strip

  • strip_bom
  • strip_tags

Utils

  • ASCII_LETTERS
  • ASCII_LOWERCASE
  • ASCII_UPPERCASE
  • DIGITS
  • HEXDIGITS
  • OCTDIGITS
  • PUNCTUATION
  • PRINTABLE
  • WHITESPACE
  • VERSION

Copyright

Coded by A. Merezhanyi

License

Licensed under MIT License

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rustruststringstring-formatterstring-manipulation

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类数据库
定价开源

> 相关工具

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库