[][src]Function utf8_slice::from

pub fn from(s: &str, begin: usize) -> &str

Fetches a slice of a string from a starting index taking into account utf8/unicode character indices.


  • s - An input string to take the slice from
  • begin - Where the slice begins


let s = "The 🚀 goes to the 🌑!";

let rocket_goes_to_the_moon = utf8_slice::from(s, 4);
// Will equal "🚀 goes to the 🌑!"


  • Will return an empty string for invalid indices *