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
- The language can be specified by a language standard name, as used in LanguageData, or by a language entity. It can also be an alphabet specification, as used in Alphabet.
- The default language is $Language.
- The following options can be given:
-
CaseOrdering Automatic how to order upper vs. lower case IgnoreCase False whether to ignore case for ordering IgnoreDiacritics False whether to ignore diacritics for ordering IgnorePunctuation False whether to ignore punctuation for ordering Language $Language what language or alphabet to assume - If an explicit language is specified in AlphabeticOrder[…,lang], it overrides any setting for the Language option.
Examples
open allclose allBasic Examples (3)
Scope (4)
AlphabeticOrder operates over single characters or longer strings:
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)
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)
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