utf8.ncasecmp
Client-side
Server-side
Shared
Compares two strings in lower-case and returns the difference indicator (see table below) as an integer value.
Syntax
int utf8.ncasecmp ( string a, string b )Required Arguments
- a: A string character sequence.
- b: A string character sequence.
Returns
- int: value
- -1:
a < b - 0:
a == b - 1:
a > b
- -1:
Returns an integer, which indicates the difference, see the table above for further information.
Code Examples
shared
This example shows a simple comparsion of two different strings.
local a = "Hello"local b = "World"local result = utf8.ncasecmp(a, b)
if result == -1 then print("a < b") -- printedelseif result == 0 then print("a == b")elseif result == 1 then print("a > b")end