Enforcing Uppercase and Lowercase
This is an every-day-task that needs to be performed as fast as possible. These functions uses a Windows API call for this. That makes them really fast.
In practice, often not a string but a vector of strings needs to be converted. Of course it is easy enough to perform the function in question with the "each" operator to all the items of such a vector, but there is a drawback: for every single call the external function has to be established again. Performing the "each" operation inside the function is faster.
That is the reason why the functions accepts both, a simple vector of characters and a vector of such vectors.
Enforce Uppercase Characters
ToUppercase←{
tmp←'TOUPP'⎕NA'I4 USER32.C32|CharUpperA =0T'
2=|≡⍵:2⊃∘TOUPP∘⊂¨⍵
2⊃TOUPP⊂,⍵
}
Enforce Lowercase Characters
ToLowercase←{
tmp←'TOLOW'⎕NA'I4 USER32.C32|CharLowerA =0T'
2=|≡⍵:2⊃∘TOLOW∘⊂¨⍵
2⊃TOLOW⊂,⍵
}
APL Wiki