22 releases (breaking)

0.18.0 Oct 30, 2024
0.16.0 Aug 16, 2024
0.15.0 Jun 29, 2024
0.11.0 Mar 26, 2024
0.1.8 Jul 15, 2022

#2695 in Algorithms

Download history 551/week @ 2024-08-17 1205/week @ 2024-08-24 865/week @ 2024-08-31 578/week @ 2024-09-07 74/week @ 2024-09-14 48/week @ 2024-09-21 64/week @ 2024-09-28 32/week @ 2024-10-05 76/week @ 2024-10-12 53/week @ 2024-10-19 158/week @ 2024-10-26 31/week @ 2024-11-02 2/week @ 2024-11-09 41/week @ 2024-11-16 36/week @ 2024-11-23 30/week @ 2024-11-30

109 downloads per month
Used in 10 crates (4 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