Registry / utility / substring

substring

JSON →
library1.4.5rscratesunverified

Provides a substring method for string types in Rust.

# Cargo.toml [dependencies] substring = "1.4.5"
INSTALL
IMPORT
SIG · SUBSTRING
S
substring
utilityrustv1.4.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Substring
use substring::Substring;

Extract a substring from a string slice using byte indices.

use substring::Substring; let s = "hello world"; let sub = s.substring(0, 5); assert_eq!(sub, "hello");
Debug
Known issues
gotchaUses byte indices, not character indices; panics on non-UTF-8 boundaries.
fix
Use `s.chars().take(5).collect::<String>()` for character-level slicing.
affects: *
Upgrade
Version history
1.4.5latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
substring — cargo add substring · libregistry