String case: Difference between revisions
Content added Content deleted
VincentARM (talk | contribs) (add task to aarch64 assembly raspberry pi 3) |
|||
Line 1,550: | Line 1,550: | ||
EasyLang does not have string case functions. The functions provided below only work with ASCII. |
EasyLang does not have string case functions. The functions provided below only work with ASCII. |
||
<syntaxhighlight lang="easylang"> |
<syntaxhighlight lang="easylang"> |
||
func$ toUpper s$ . |
|||
proc toUppercase string$ . result$ . |
|||
for |
for c$ in strchars s$ |
||
code = strcode |
code = strcode c$ |
||
if code >= 97 and code <= 122 |
if code >= 97 and code <= 122 |
||
code -= 32 |
code -= 32 |
||
. |
. |
||
res$ &= strchar code |
|||
. |
. |
||
return res$ |
|||
. |
. |
||
func$ toLower s$ . |
|||
proc toLowercase string$ . result$ . |
|||
for |
for c$ in strchars s$ |
||
code = strcode |
code = strcode c$ |
||
if code >= 65 and code <= 90 |
if code >= 65 and code <= 90 |
||
code += 32 |
code += 32 |
||
. |
. |
||
res$ &= strchar code |
|||
. |
. |
||
return res$ |
|||
. |
. |
||
string$ = "alphaBETA" |
string$ = "alphaBETA" |
||
print string$ |
print string$ |
||
print toUpper string$ |
|||
print |
print toLower string$ |
||
result$ = "" |
|||
call toLowercase string$ result$ |
|||
print result$ |
|||
</syntaxhighlight> |
</syntaxhighlight> |
||
{{out}} |
{{out}} |