_matchCase
Tweaks the case of the received Text to match that of the Function this is defined in. --
Function
Text Type -> _matchCase
(levels) -> Text Type
- Receives -- Text Type
- Some text, usually one word
- levels (optional)
- The number of levels up that this will look for the match
- Produces
- The received text, capitalized if this Function was capitalized
This is a very specialized function, designed for cases where you want to define a Text or Function
that results in some Text, but you want the case of that Text (upper or lower) to match the way
the Function was invoked.
So for example, if you have a Function named Sie (one of the common choices for a gender-neutral
pronoun), which produces "he" if the received value is male or "she" if it's female, you would
use _matchCase so that, when I invoke it as [[James -> sie]] I get "he", but when I invoke it
as [[Mary -> Sie]], I get "She".
Occasionally, you want to use this in a Function that is intended for use inside other Functions.
You can use the levels
parameter to specify how far up to look. By default it is 1 (this Function);
if you set it to 2 it will be the Function that called this one, and so on.
This will probably get moved to a text-manipulation Mixin at some time down the road.