String case: Difference between revisions
Content added Content deleted
(→{{header|Vlang}}: Rename "Vlang" in "V (Vlang)") |
Jazzedpineda (talk | contribs) (Add EasyLang) |
||
Line 1,346: | Line 1,346: | ||
<syntaxhighlight lang="e">["alphaBETA".toUpperCase(), |
<syntaxhighlight lang="e">["alphaBETA".toUpperCase(), |
||
"alphaBETA".toLowerCase()]</syntaxhighlight> |
"alphaBETA".toLowerCase()]</syntaxhighlight> |
||
=={{header|EasyLang}}== |
|||
EasyLang does not have string case functions. The functions provided below only work with ASCII. |
|||
<syntaxhighlight lang="easylang"> |
|||
func toUppercase string$ . result$ . |
|||
for i = 1 to len string$ |
|||
code = strcode substr string$ i 1 |
|||
if code >= 97 and code <= 122 |
|||
code -= 32 |
|||
. |
|||
result$ &= strchar code |
|||
. |
|||
. |
|||
func toLowercase string$ . result$ . |
|||
for i = 1 to len string$ |
|||
code = strcode substr string$ i 1 |
|||
if code >= 65 and code <= 90 |
|||
code += 32 |
|||
. |
|||
result$ &= strchar code |
|||
. |
|||
. |
|||
string$ = "alphaBETA" |
|||
print string$ |
|||
call toUppercase string$ result$ |
|||
print result$ |
|||
result$ = "" |
|||
call toLowercase string$ result$ |
|||
print result$ |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
alphaBETA |
|||
ALPHABETA |
|||
alphabeta |
|||
</pre> |
|||
=={{header|EchoLisp}}== |
=={{header|EchoLisp}}== |