21 releases (breaking)

0.17.0 Sep 5, 2024
0.15.0 Jun 29, 2024
0.11.0 Mar 26, 2024
0.3.0 Oct 28, 2023
0.1.8 Jul 15, 2022

#1195 in Algorithms

Download history 60/week @ 2024-06-10 98/week @ 2024-06-17 244/week @ 2024-06-24 137/week @ 2024-07-01 12/week @ 2024-07-08 45/week @ 2024-07-15 62/week @ 2024-07-22 238/week @ 2024-07-29 18/week @ 2024-08-05 153/week @ 2024-08-12 510/week @ 2024-08-19 1378/week @ 2024-08-26 710/week @ 2024-09-02 557/week @ 2024-09-09 77/week @ 2024-09-16 81/week @ 2024-09-23

1,433 downloads per month
Used in 9 crates (3 directly)

MIT license

115KB
1.5K SLoC

Module :: strs_tools

experimental rust-status docs.rs Open in Gitpod discord

Tools to manipulate strings.

Basic use-case

#[ cfg( all( feature = "split", not( feature = "no_std" ) ) ) ]
{
  /* delimeter exists */
  let src = "abc def";
  let iter = strs_tools::string::split()
  .src( src )
  .delimeter( " " )
  .stripping( false )
  .perform();
  let iterated = iter.map( | e | String::from( e ) ).collect::< Vec< _ > >();
  assert_eq!( iterated, vec![ "abc", " ", "def" ] );

  /* delimeter not exists */
  let src = "abc def";
  let iter = strs_tools::string::split()
  .src( src )
  .delimeter( "g" )
  .perform();
  let iterated = iter.map( | e | String::from( e ) ).collect::< Vec< _ > >();
  assert_eq!( iterated, vec![ "abc def" ] );
}

To add to your project

cargo add strs_tools

Try out from the repository

git clone https://github.com/Wandalen/wTools
cd wTools
cd examples/wstring_tools_trivial
cargo run

Sample

discord Open in Gitpod docs.rs

Dependencies

~1.5–2MB
~41K SLoC