| Crates.io | substrs |
| lib.rs | substrs |
| version | 0.1.0 |
| created_at | 2020-07-19 04:33:09.410346+00 |
| updated_at | 2020-07-19 04:33:09.410346+00 |
| description | A crate for substring functionality for the str type in Rust |
| homepage | https://github.com/srbdev/substr |
| repository | https://github.com/srbdev/substr |
| max_upload_size | |
| id | 266749 |
| size | 5,982 |
A helper crate for substring functionality for Rust's str type.
Add the following to your project's Cargo.toml to include substr as a dependencie.
[dependencies]
substr = { git = "https://github.com/srbdev/substr" }
fn firstn(s: &str, n: usize) -> &strReturns the first nth characters from the input string s.
fn lastn(s: &str, n: usize) -> &strReturns the last nth characters from the input string s.
fn slice(s: &str, start: usize, end: usize) -> &strReturn the substring of the input string s with indices [start, end).
Note: substr will only work on UTF-8 sequences or may otherwise reference invalid memory or
violate the invariants communicated by the str type.