How to format text variable cases?

In many games that I have read, there are variables that are entered via text, like names, preferred swear words, colours, etc. For some of these, however, apparently it can be formatted so that a few letters have their cases changed or something similar like that. How do I do that?

Example: In a few games, you can enter in a custom swear word for your character to exclaim. Then, the text is specially formatted so that, say, if it was all in lower case when you entered it, occasionally, it will change to uppercase in the first letter because it’s at the beginning of a sentence. How do you do that?

*create abc "abc"

This is in lowercase; ${abc}

And this is in uppercase; $!{abc}

We would then get;

This is in lowercase; abc

And this is in uppercase; Abc

You can change the first letter of a text string from lowercase to uppercase by using $!{abc} instead of ${abc}.


And also this one:

*create var "name"

$!!{var} will show up as NAME