String case: Difference between revisions

Content deleted Content added
Puppydrum64 (talk | contribs)
Puppydrum64 (talk | contribs)
Line 3,049: Line 3,049:


=={{header|Z80 Assembly}}==
=={{header|Z80 Assembly}}==
The English alphabet is a subset of the ASCII character set, and the upper and lower case letters are 32 bytes apart. Bit 5 "toggles" the case of any letter in this range. Assuming your string exists in RAM, these subroutines are all that is needed to switch the string from upper to lower case and back.
The English alphabet is a subset of the ASCII character set, and the upper and lower case letters are 32 bytes apart. Bit 5 "toggles" the case of any letter in this range. Assuming your string exists in RAM, these subroutines are all that is needed to switch the string from upper to lower case, and vice versa. The first two functions are destructive, meaning that you cannot recover the original string after using them. The <code>ToggleCase</code> function can be performed twice on the same string to get the original string back.


<lang z80>ToUpperCase:
<lang z80>ToUpperCase:
Line 3,134: Line 3,134:
ALPHAbeta
ALPHAbeta
</pre>
</pre>



=={{header|zkl}}==
=={{header|zkl}}==