Function alphabetical

  • For use with sorting functions such as sortWith or the built-in Array.prototype.sort(). Sorts in ascending alphabetical order, ignoring all spaces and punctuation. For the same letter, upper case letters come before lower case letters.

    Remarks

    For languages other than English, or for other conventions regarding punctuation, letter case, etc., use alphaLocale.

    As of this writing (January 3, 2023), some Android browsers do not support this function..

    Example

    import * as A from "flurp/array";
    import * as C from "flurp/comparator";

    const sortAlpha = A.sortWith(C.alphabeticalNullable);
    sortSv(["a", "a c", "ab", "Ab"]); // ["a", "Ab", "ab", "a c"]

    Parameters

    • a: string
    • b: string

    Returns number