char_length

Function char_length 

Source
pub fn char_length(str_input: &str) -> usize
Expand description

Returns the length of a string in Unicode characters.

§Arguments

  • str_input - The input string to count characters from

§Returns

  • usize - The number of Unicode characters in the string

§Examples

use lowdash::char_length;

assert_eq!(char_length("hello"), 5);
assert_eq!(char_length("🌍world"), 6);
assert_eq!(char_length("こんにちは"), 5);