String case: Difference between revisions

Content added Content deleted
(add Crystal)
(→‎{{header|Lua}}: add short form and Unicode limitation)
Line 1,999: Line 1,999:
=={{header|Lua}}==
=={{header|Lua}}==
<syntaxhighlight lang="lua">str = "alphaBETA"
<syntaxhighlight lang="lua">str = "alphaBETA"

print( string.upper(str) )
print( string.lower(str) )</syntaxhighlight>
print( string.upper(str) ) -- ALPHABETA
print( string.lower(str) ) -- alphabeta

print ( str:upper() ) -- ALPHABETA
print ( str:lower() ) -- alphabeta
</syntaxhighlight>

The [https://www.lua.org/pil/20.html string library] properly works only for ASCII and extended ASCII (depending on the locals) ranges but not for Unicode.

<syntaxhighlight lang="lua">print ( string.upper("ação") ) -- returns AçãO instead of AÇÃO
print ( string.upper("ĥåçýджк") ) -- returns ĥåçýджк instead of ĤÅÇÝДЖК
</syntaxhighlight>


=={{header|M4}}==
=={{header|M4}}==