Utf8.fold: Difference between revisions
Jump to navigation
Jump to search
m (swap with utf8.lower) |
m (Split syntax into different boxes) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Shared function}} | {{Shared function}} | ||
{{Note|You may want to read up on [https://www.w3.org/International/wiki/Case_folding case folding] for more information about the use of this function.}} | |||
Converts a UTF-8 string to | Converts a UTF-8 string to folded case (lowercase), which can be used to compare two strings. If ''input'' is an integer, it's treat as a codepoint and a convert codepoint (integer) is returned. | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua">string utf8. | <syntaxhighlight lang="lua"> | ||
string utf8. | string|int utf8.fold ( string|int input ) | ||
</syntaxhighlight> | |||
<syntaxhighlight lang="lua"> | |||
string|int utf8.lower ( string|int input ) | |||
</syntaxhighlight> | |||
===Required Arguments=== | ===Required Arguments=== | ||
Line 12: | Line 16: | ||
===Returns=== | ===Returns=== | ||
Returns a ''string'' in | Returns a ''string'' in lowercase OR returns an ''integer'' (see description). | ||
==Example== | ==Example== | ||
<section name="Server" class="server" show="true"> | <section name="Server" class="server" show="true"> | ||
This example shows how to convert a string to | This example shows how to convert a string to lowercase, which can be used to compare with other folded strings. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
local output = utf8.lower( "WHAT ARE YOU UP TO? Do you like uppercase?" ) | local output = utf8.lower( "WHAT ARE YOU UP TO? Do you like uppercase?" ) |
Latest revision as of 13:12, 30 April 2021
Note: You may want to read up on case folding for more information about the use of this function. |
Converts a UTF-8 string to folded case (lowercase), which can be used to compare two strings. If input is an integer, it's treat as a codepoint and a convert codepoint (integer) is returned.
Syntax
string|int utf8.fold ( string|int input )
string|int utf8.lower ( string|int input )
Required Arguments
- input: A string character sequence OR an integer value
Returns
Returns a string in lowercase OR returns an integer (see description).
Example
Click to collapse [-]
ServerThis example shows how to convert a string to lowercase, which can be used to compare with other folded strings.
local output = utf8.lower( "WHAT ARE YOU UP TO? Do you like uppercase?" ) print( output ) -- what are you up to? do you like uppercase? local value = utf8.fold( 1088 ) print( type( value ) ) -- number
See Also
Shared
- utf8.byte
- utf8.char
- utf8.charpos
- utf8.escape
- utf8.find
- utf8.fold
- utf8.gmatch
- utf8.gsub
- utf8.insert
- utf8.len
- utf8.lower
- utf8.match
- utf8.ncasecmp
- utf8.next
- utf8.remove
- utf8.reverse
- utf8.sub
- utf8.title
- utf8.upper
- utf8.width
- utf8.widthindex