Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

uc

Converts a string to uppercase.

Returns an uppercased copy of STRING. For ASCII input, an in-place byte mutation fast path avoids allocation when a TARG pad slot is available. For Unicode input, Rust’s to_uppercase() is used, which handles case mappings that change byte length (e.g. the German sharp-s \u{00DF} becomes "SS").

Synopsis

$upper = uc($string);
$upper = uc('hello');   # "HELLO"

Implementation Notes

perl5 reference: pp.c:4441 PP_wrapped(pp_uc, 1, 0). Non-UTF-8 path: when IN_LC_RUNTIME(LC_CTYPE), use libc::toupper() for each byte (perl5: pp.c:4591 for (s < send) *d = toUPPER_LC(*s)). UTF-8 path: deferred – for now uses Unicode case folding. perl5: pp.c:4583-4619.

See Also

PP runtime: uc | lc, ucfirst, lcfirst