strsplit 0.1.1

Split a string slice using a delimiter of your choice
Documentation
  • Coverage
  • 100%
    3 out of 3 items documented2 out of 2 items with examples
  • Size
  • Source code size: 4.14 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.04 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • amschel99/strsplit
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • amschel99

Strsplit

Rust Crates.io Docs.rs

strsplit is a crate that provides a Strsplit struct and a utility function until_char for splitting strings efficiently.

Usage

Add this to your Cargo.toml:

[dependencies]
strsplit = "0.1.1"

Then you can use it in your code:

use strsplit::Strsplit;

let haystack = "a,b,c,d,e,f";
let letters: Vec<_> = Strsplit::new(&haystack, ",").collect();
assert_eq!(letters, vec!["a", "b", "c", "d", "e", "f"]);

Function: until_char

The until_char function returns the string before the first instance of the delimiter is found.

use strsplit::until_char;
let haystack = "hello";
let trimmed = until_char(&haystack, 'o');
assert_eq!(trimmed, "hell");