Tcl_UtfToUpper(3tcl)
β¨ NAME β¨
okay bestie so this is Tcl_UniCharToUpper, Tcl_UniCharToLower, Tcl_UniCharToTitle, Tcl_UtfToUpper, Tcl_UtfToLower, and Tcl_UtfToTitle β literally the whole girl gang of routines for manipulating the case of Unicode characters and UTF-8 strings π
(it's 3tcl, the Tcl Library Procedures chapter, iykyk)
πΈ SYNOPSIS πΈ
#include <tcl.h>
int
Tcl_UniCharToUpper(ch)
int
Tcl_UniCharToLower(ch)
int
Tcl_UniCharToTitle(ch)
Tcl_Size
Tcl_UtfToUpper(str)
Tcl_Size
Tcl_UtfToLower(str)
Tcl_Size
Tcl_UtfToTitle(str)
π ARGUMENTS π
int ch(in) β the Unicode character that's getting its case done πchar *str(in/out) β pointer to the TUTF-8 byte sequence that gets converted in place, no copy, no extra drama
π DESCRIPTION π
N.B. go read the Tcl_UniChar documentation page first, bestie β that's where the TUTF-8 encoding and all the related terms referenced here get explained. It's giving prerequisite reading, fr fr.
π the first three β one character at a time
The first three routines convert the case of individual Unicode characters:
- If
chrepresents a lower-case character,Tcl_UniCharToUpperreturns the corresponding upper-case character. If no upper-case character is defined, it returns the character unchanged β no cap, it just hands it back. - If
chrepresents an upper-case character,Tcl_UniCharToLowerreturns the corresponding lower-case character. If no lower-case character is defined, it returns the character unchanged. - If
chrepresents a lower-case character,Tcl_UniCharToTitlereturns the corresponding title-case character. If no title-case character is defined, it returns the corresponding upper-case character. And if no upper-case character is defined, it returns the character unchanged.
Title-case is only defined for a small number of characters β the ones that literally look different when they're sitting at the beginning of a capitalized word. Rare queen behavior, honestly. π
π¦ the next three β whole strings, in place
The next three routines convert the case of null-terminated TUTF-8 byte sequences in place in memory:
Tcl_UtfToUpperchanges every TUTF-8 encoded character instrto upper-case. Because changing the case of a character may change its size, the byte offset of each character in the resulting string may differ from its original location β so don't come for the old byte offsets, they're not invited anymore π.Tcl_UtfToUpperwrites a null byte at the end of the converted string. It returns the new length of the string in bytes, and this new length is guaranteed to be no longer than the original string length. Slay.Tcl_UtfToLoweris the same asTcl_UtfToUpperexcept it turns each character in the string into its lower-case equivalent. Same energy, lowercase fit. πTcl_UtfToTitleis the same asTcl_UtfToUpperexcept it turns the first character in the string into its title-case equivalent and all following characters into their lower-case equivalents. Main character energy for exactly one character, everyone else falls in line. π
π₯ KEYWORDS π₯
utf, unicode, toupper, tolower, totitle, case
βΏ this has been Tcl library procedures realness, straight out of Tcl 8.1 βΏ
kisses, take care of ur strings, and remember: in-place conversion means no takebacks π«Άπ
π¦ where this page comes from
- ubuntu stonking: tcl9.0-doc 9.0.4+dfsg-1
- Copyright (c) 1997 Sun Microsystems, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms