Compare two JS strings.
bool JS_CompareStrings(JSContext *cx, JSString *str1, JSString *str2, int32_t *result);
||The context to which both strings must belong.|
||First string to compare.|
||Second string to compare.|
||The out parameter. See description for value of
JS_CompareStrings compares two JS strings,
str2. If the strings are identical in content and length,
str1 is less than
*result is less than 0. If
str1 is greater than
*result is greater than 0.
On success the function returns
JS_TRUE. On error, it returns
JS_FALSE and the value in
result is unchanged.
>=), as described in ECMA 262-3 § 11.8.5. As the standard says:
The comparison of strings uses a simple lexicographic ordering on sequences of code point value values. There is no attempt to use the more complex, semantically oriented definitions of character or string equality and collating order defined in the Unicode specification. Therefore strings that are canonically equal according to the Unicode standard could test as unequal.