Type Function Library utf8.* Return value Number Revision Release 2022.3683 Keywords utf8, UTF-8, Unicode, string, ncasecmp
Compares strings a
and b
, ignoring case. Returns an integer as follows:
Condition | Returns |
---|---|
a < b |
-1 |
a == b |
0 |
a > b |
1 |
utf8.ncasecmp( a, b )
String. The first string.
String. The second string.
local utf8 = require( "plugin.utf8" ) local str1 = "♡ 你好,世界 ♡" local str2 = str1 print( utf8.ncasecmp( str1, str2 ) ) --> 0 (same string) str2 = utf8.insert( str1, 3, "UTF-8 " ) print( utf8.ncasecmp( str1, str2 ) ) --> 1 (different strings)