I have a string that I would like to change the case of only the first letter to upper case. This string can be any word. Anyhow, I am trying to apply string mapping to it to accomplish this. Yeah, sure I could map each character of the alphabet to its corresponding uppercase value but that wouldn't be any fun.
set stringWord morning
proc changeCase {instring} {
set newString [string map "$instring" {[string range $instring 0 0] [string toupper [string range $instring 0 0]]}]
};
set stringWord2 [changeCase $stringWord]
The value being passed to the proc is "morning" with the resulting value of "Morning" being returned.
TIA
Harold
set stringWord morning
proc changeCase {instring} {
set newString [string map "$instring" {[string range $instring 0 0] [string toupper [string range $instring 0 0]]}]
};
set stringWord2 [changeCase $stringWord]
The value being passed to the proc is "morning" with the resulting value of "Morning" being returned.
TIA
Harold