Function roe::to_ascii_uppercase[][src]

pub fn to_ascii_uppercase<T: AsRef<[u8]>>(slice: T) -> Vec<u8>
This is supported on crate feature alloc only.

Returns a vector containing a copy of the given slice where each byte is mapped to its ASCII upper case equivalent.

ASCII letters 'a' to 'z' are mapped to 'A' to 'Z', but non-ASCII letters are unchanged.

This function can be used to implement String#upcase and Symbol#upcase for ASCII strings in Ruby.

To uppercase the value in-place, use make_ascii_uppercase.

See also <[u8]>::to_ascii_uppercase.

Examples

assert_eq!(to_ascii_uppercase("ABCxyz"), &b"ABCXYZ"[..]);
assert_eq!(to_ascii_uppercase("1234%&*"), &b"1234%&*"[..]);