import { compare } from "https://deno.land/x/ayonli_jsext@v0.9.72/esm/string.js";
Compares two strings, returns -1
if a < b
, 0
if a === b
and 1
if a > b
.
NOTE: prefer using String.prototype.localeCompare
instead.
Examples
Example 1
Example 1
import { compare } from "@ayonli/jsext/string";
console.log(compare("a", "b")); // -1
console.log(compare("b", "a")); // 1
console.log(compare("a", "a")); // 0