Skip to content

slicestring is a crate for slicing Strings in Rust.

Notifications You must be signed in to change notification settings

floscodes/slicestring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 

Repository files navigation

slicestring

slicestring is a crate for slicing Strings. It provides the slice() method for String and &str. It takes a std::ops::Range as an argument. It slices the String or &str and returns the sliced one as a String.

Examples:

use slicestring::Slice;

let mut s = "hello world!";
s = s.slice(..5);
assert_eq!("hello", s);

It also works with emoticons since the slice method takes into account characters.

use slicestring::Slice;

let mut s = String::from("hello 😃");
s = s.slice(5..);
assert_eq!("😃", s);

About

slicestring is a crate for slicing Strings in Rust.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages