strs_tools

Crates.iostrs_tools
lib.rsstrs_tools
version0.18.0
sourcesrc
created_at2022-06-12 06:44:33.476186
updated_at2024-10-30 10:34:40.559228
descriptionTools to manipulate strings.
homepagehttps://github.com/Wandalen/wTools/tree/master/module/core/strs_tools
repositoryhttps://github.com/Wandalen/wTools/tree/master/module/core/strs_tools
max_upload_size
id604409
size87,919
Wandalen (Wandalen)

documentation

https://docs.rs/strs_tools

README

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

Commit count: 0

cargo fmt