AlphabeticOrder

AlphabeticOrder["string1","string2"]

gives 1 if "string1" appears before "string2" in alphabetical order, -1 if it is after, and 0 if it is identical.

AlphabeticOrder["string1","string2",lang]

uses an ordering suitable for the language lang.

AlphabeticOrder[lang]

represents an operator form that compares strings when applied to "string1", "string2".

Details and Options

Examples

open allclose all

Basic Examples  (3)

Check the order of two characters:

Specify a language as the third argument:

When digraphs exist in a language, they are equivalent to corresponding pairs of ASCII characters:

Scope  (4)

AlphabeticOrder operates over single characters or longer strings:

Use the operator form:

Specify a language in operator form:

Use options in operator form:

Options  (8)

CaseOrdering  (2)

CaseOrdering->"LowerFirst" orders lowercase before uppercase letters. It is the default for most languages:

CaseOrdering->"UpperFirst" orders uppercase before lowercase letters:

IgnoreCase  (2)

With IgnoreCase->True, comparisons are case insensitive:

Equivalence between lower case and upper case can vary by language:

IgnoreDiacritics  (3)

With IgnoreDiacritics->True, comparisons are based only on basic letters from the alphabet:

When characters with diacritics are considered to be a fundamental part of a given alphabet, IgnoreDiacritics will not affect those characters:

The IgnoreDiacritics option can be mixed with any other option, such as IgnoreCase:

IgnorePunctuation  (1)

With IgnorePunctuation->True, punctuation characters are removed before comparing the strings:

Applications  (2)

Sort the Japanese names of countries with Wolfram offices:

When digraphs are part of a language, they will be ordered correctly (as in Slovak, where "ch" is after "h"):

Properties & Relations  (4)

Use the operator form of AlphabeticOrder to confirm that Alphabet of the same language is already ordered:

The results from AlphabeticOrder and Order may differ for non-English languages:

For some languages, using IgnoreDiacritics may give a different result than applying RemoveDiacritics first:

AlphabeticSort uses AlphabeticOrder as its ordering function:

Possible Issues  (1)

Different characters that represent the same letter in some languages are considered exact equivalents:

Neat Examples  (1)

Find all Unicode characters considered equivalent to "a" without taking into account diacritics or case:

Sort alphabetically:

Split by case:

Wolfram Research (2015), AlphabeticOrder, Wolfram Language function, https://reference.wolfram.com/language/ref/AlphabeticOrder.html.

Text

Wolfram Research (2015), AlphabeticOrder, Wolfram Language function, https://reference.wolfram.com/language/ref/AlphabeticOrder.html.

CMS

Wolfram Language. 2015. "AlphabeticOrder." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/AlphabeticOrder.html.

APA

Wolfram Language. (2015). AlphabeticOrder. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AlphabeticOrder.html

BibTeX

@misc{reference.wolfram_2024_alphabeticorder, author="Wolfram Research", title="{AlphabeticOrder}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/AlphabeticOrder.html}", note=[Accessed: 21-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_alphabeticorder, organization={Wolfram Research}, title={AlphabeticOrder}, year={2015}, url={https://reference.wolfram.com/language/ref/AlphabeticOrder.html}, note=[Accessed: 21-December-2024 ]}