Crates.io | slicer |
lib.rs | slicer |
version | 0.1.1 |
source | src |
created_at | 2018-05-03 01:07:10.903948 |
updated_at | 2018-05-03 01:19:28.343729 |
description | A utility that slices string slices into smaller string slices. |
homepage | https://github.com/squishy-clouds/slicer |
repository | https://github.com/squishy-clouds/slicer |
max_upload_size | |
id | 63506 |
size | 48,685 |
A simple, efficient utility for slicing string slices into smaller string slices. Useful for parsing anything represented by strings, such as programming languages or data formats.
Basic usage:
use slicer::AsSlicer;
let path = "images/cat.jpeg";
let mut slicer = path.as_slicer();
let directory = slicer.slice_until("/");
slicer.skip_over("/");
let filename = slicer.slice_until(".");
slicer.skip_over(".");
let extension = slicer.slice_to_end();
assert_eq!(Some("images"), directory);
assert_eq!(Some("cat"), filename);
assert_eq!(Some("jpeg"), extension);
This crate is licensed under the terms of both the MIT License and the Apache License 2.0.