[][src]Function phpify::string::strlen

pub fn strlen<S>(string: S) -> usize where
    S: AsRef<str>, 

Get string length.

Description

Returns the length of the given string.

Examples

Example #1 strlen() example

use phpify::string::strlen;

let str = "abcdef";
assert_eq!(strlen(str), 6);

let str = " ab cd ";
assert_eq!(strlen(str), 7);

notes

strlen() returns the number of bytes rather than the number of characters in a string.