[−][src]Function utf8_slice::till
pub fn till(s: &str, end: usize) -> &str
Fetches a slice of a string until an ending index taking into account utf8/unicode character indices.
Arguments
s
- An input string to take the slice fromend
- Where the slice ends
Examples
let s = "The 🚀 goes to the 🌑!"; let the_rocket = utf8_slice::till(s, 5); // Will equal "The 🚀"
Note
- Will return an empty string for invalid indices *