String case: Difference between revisions

Content added Content deleted
(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 i = 1 to len string$
for c$ in strchars s$
code = strcode substr string$ i 1
code = strcode c$
if code >= 97 and code <= 122
if code >= 97 and code <= 122
code -= 32
code -= 32
.
.
result$ &= strchar code
res$ &= strchar code
.
.
return res$
.
.
func$ toLower s$ .
proc toLowercase string$ . result$ .
for i = 1 to len string$
for c$ in strchars s$
code = strcode substr string$ i 1
code = strcode c$
if code >= 65 and code <= 90
if code >= 65 and code <= 90
code += 32
code += 32
.
.
result$ &= strchar code
res$ &= strchar code
.
.
return res$
.
.
string$ = "alphaBETA"
string$ = "alphaBETA"
print string$
print string$
call toUppercase string$ result$
print toUpper string$
print result$
print toLower string$
result$ = ""
call toLowercase string$ result$
print result$
</syntaxhighlight>
</syntaxhighlight>
{{out}}
{{out}}