I am new to Node.js. And need a npm package or some module to compare to string in UTF-16 format.
In C# I have the following function:
public int Compare(string x, string y)
{
var myComparer = CompareInfo.GetCompareInfo("en-US");
return myComparer.Compare(x, y, CompareOptions.Ordinal);
}
I want the same behavior in this c# code to be written in Node.js
Thanks in advance
Check out
String.prototype.localeCompare(compareString[, locales[, options]])
.Your equivalent might be
x.localeCompare(y, "en-US")
.