| Crates.io | strs_tools |
| lib.rs | strs_tools |
| version | 0.31.0 |
| created_at | 2022-06-12 06:44:33.476186+00 |
| updated_at | 2025-09-23 09:58:00.520041+00 |
| description | Tools to manipulate strings. |
| homepage | https://github.com/Wandalen/wTools/tree/master/module/core/strs_tools |
| repository | https://github.com/Wandalen/wTools/tree/master/module/core/strs_tools |
| max_upload_size | |
| id | 604409 |
| size | 651,010 |
Advanced string manipulation tools with SIMD acceleration and intelligent parsing.
While Rust's standard library provides basic string operations, strs_tools offers sophisticated string manipulation capabilities that handle real-world complexity:
Cow<str>cargo add strs_tools
Unlike standard str.split(), handles quotes and preserves context:
# #[cfg(all(feature = "string_split", not(feature = "no_std")))]
# {
use strs_tools::string;
// Basic splitting with delimiter preservation
let text = "hello world test";
let result : Vec< String > = string::split()
.src( text )
.delimiter( " " )
.preserving_delimiters( true ) // Keep delimiters
.perform()
.map( String::from )
.collect();
assert_eq!( result, vec![ "hello", " ", "world", " ", "test" ] );
// Quote-aware splitting (perfect for parsing commands)
let command = r#"run --file "my file.txt" --verbose"#;
let parts : Vec< String > = string::split()
.src( command )
.delimiter( " " )
.quoting( true ) // Handle quotes intelligently
.perform()
.map( String::from )
.collect();
// Results: ["run", "--file", "my file.txt", "--verbose"]
# }
Add consistent indentation to multi-line text:
# #[cfg(all(feature = "string_indentation", not(feature = "no_std")))]
# {
use strs_tools::string;
let code = "fn main() {\n println!(\"Hello\");\n}";
let indented = string::indentation::indentation( " ", code, "" );
// Result: " fn main() {\n println!(\"Hello\");\n }"
# }
Parse command-line style strings into structured data:
use strs_tools::string;
let input = "deploy --env production --force --config ./deploy.toml";
// Command parsing functionality under development
println!( "Command: {}", input );
// Note: Full parse_request API is still being finalized
Robust number parsing with multiple format support:
let values = [ "42", "3.14", "1e6" ];
for val in values
{
if let Ok( num ) = val.parse::< f64 >()
{
println!( "{} = {}", val, num );
}
}
Enable SIMD acceleration for demanding applications:
[dependencies]
strs_tools = { version = "0.30", features = ["simd"] }
SIMD features provide significant speedups for:
Choose only the functionality you need:
[dependencies]
strs_tools = {
version = "0.30",
features = ["string_split", "string_parse_request"],
default-features = false
}
Available features:
string_split - Advanced splitting with quotes and escapingstring_indentation - Text indentation toolsstring_isolate - String isolation by delimitersstring_parse_request - Command parsing utilitiesstring_parse_number - Number parsing from stringssimd - SIMD acceleration (recommended for performance)Perfect for:
Alternatives:
str methods for simple splitting and basic operationsregex crate for complex pattern matchingclap or structopt for full CLI argument parsing frameworksExplore comprehensive examples showing real-world usage:
git clone https://github.com/Wandalen/wTools
cd wTools/module/core/strs_tools
# Run examples by number
cargo run --example 001_basic_usage
cargo run --example 002_advanced_splitting
cargo run --example 003_text_indentation
cargo run --example 004_command_parsing
cargo run --example 005_string_isolation
cargo run --example 006_number_parsing
cargo run --example 007_performance_and_simd --features simd