({{, (RefLink[AlphabeticSort, paclet:ref/AlphabeticSort])[list] 
sorts the elements of list into alphabetical order.}, {, (RefLink[AlphabeticSort, paclet:ref/AlphabeticSort])[list,lang]
sorts using an ordering suitable for the language lang.}})

OpenersNotesSection(Spacer1)Details and Options

The language can be specified by a language standard name, as used in (RefLink[LanguageData, paclet:ref/LanguageData]), or by a language entity. It can also be an alphabet specification, as used in (RefLink[Alphabet, paclet:ref/Alphabet]).

The default language is (RefLink[$Language, paclet:ref/$Language]).

The following options can be given:

If an explicit language is specified in (RefLink[AlphabeticSort, paclet:ref/AlphabeticSort])[…,lang], it overrides any setting for the (RefLink[Language, paclet:ref/Language]) option.

OpenersPrimaryExamplesSection(Spacer1)Examples  (12)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Sort words using the default (RefLink[$Language, paclet:ref/$Language]):

words=RandomChoice[WordList[],20]

AlphabeticSort[words]

Use ordering rules for a specific language:

words=RandomChoice[WordList["Language"->LinguisticAssistant],20]

AlphabeticSort[words,"Swedish"]

OpenersExampleSection1(Spacer1)Scope  (1)

Specify the language as an argument:

AlphabeticSort[{"Encyclopædia","Encyclopedia","Encyclopaedia"},"Swedish"]

Specify the language as an option:

AlphabeticSort[{"アメリカ合衆国","日本","イギリス","ペルー","スウェーデン"},Language->(Entity["Japanese", Entity["Language","Japanese"], "Entity[\"Language\", \"Japanese\"]", "language"])]

OpenersExampleSection2(Spacer1)Options  (5)

OpenersExampleSubsection0(Spacer1)CaseOrdering  (2)

(RefLink[CaseOrdering, paclet:ref/CaseOrdering])->"LowerFirst" is the default value for most languages:

AlphabeticSort[{"A","a","æ","Æ","i","I"},"English",CaseOrdering->"LowerFirst"]

%===AlphabeticSort[{"A","a","æ","Æ","i","I"},"English"]

(RefLink[CaseOrdering, paclet:ref/CaseOrdering])->"UpperFirst" is the default value for some languages:

AlphabeticSort[{"A","a","æ","Æ","i","I"},"Danish",CaseOrdering->"UpperFirst"]

%===AlphabeticSort[{"A","a","æ","Æ","i","I"},"Danish"]

OpenersExampleSubsection1(Spacer1)IgnoreCase  (1)

(RefLink[IgnoreCase, paclet:ref/IgnoreCase])->True treats the uppercase and lowercase forms of a letter as equivalent:

AlphabeticSort[{"Ñ","ĳ","ñ","Ş","Ĳ","ş"},"Dutch",IgnoreCase->True]

OpenersExampleSubsection2(Spacer1)IgnoreDiacritics  (1)

(RefLink[IgnoreDiacritics, paclet:ref/IgnoreDiacritics])->(RefLink[True, paclet:ref/True]) ignores diacritic marks in the specified language:

AlphabeticSort[{"sonar","cañón","soñar","cuña","canon","papá","cuna","papa"},"Spanish",IgnoreDiacritics->True]

The same words in a different language may have a different order when ignoring diacritics:

AlphabeticSort[{"sonar","cañón","soñar","cuña","canon","papá","cuna","papa"},"English",IgnoreDiacritics->True]

OpenersExampleSubsection3(Spacer1)IgnorePunctuation  (1)

(RefLink[IgnorePunctuation, paclet:ref/IgnorePunctuation])->(RefLink[True, paclet:ref/True]) sorts after removing all punctuation marks and whitespace:

AlphabeticSort[{"File-2","File 1","File4","File 3"},IgnorePunctuation->True]

The default value of (RefLink[IgnorePunctuation, paclet:ref/IgnorePunctuation]) is (RefLink[False, paclet:ref/False]):

AlphabeticSort[{"File-2","File 1","File4","File 3"},IgnorePunctuation->False]

OpenersExampleSection3(Spacer1)Properties & Relations  (1)

(RefLink[AlphabeticSort, paclet:ref/AlphabeticSort]) is equivalent to using (RefLink[Sort, paclet:ref/Sort]) plus (RefLink[AlphabeticOrder, paclet:ref/AlphabeticOrder]) as an ordering function:

stopWords=WordList["Stopwords",Language->"English"];

AlphabeticSort[stopWords,CaseOrdering->"UpperFirst"]===Sort[stopWords,AlphabeticOrder[CaseOrdering->"UpperFirst"][##]≥0&]

OpenersExampleSection4(Spacer1)Possible Issues  (2)

In the "Turkish" language, the equivalence between lower and upper case for the letter "i" is different than in other languages:

AlphabeticSort[{"A","a","i","I","ı","İ"},"Turkish",CaseOrdering->"UpperFirst"]

The (RefLink[IgnoreCase, paclet:ref/IgnoreCase]) option overrides any value (RefLink[CaseOrdering, paclet:ref/CaseOrdering]) may have:

AlphabeticSort[{"A","a","i","I","ı","İ"},"Turkish",CaseOrdering->"UpperFirst",IgnoreCase->True]

OpenersExampleSection5(Spacer1)Neat Examples  (1)

Use (RefLink[AlphabeticSort, paclet:ref/AlphabeticSort]) to get a sorted list of 2000 random words:

russianWords=AlphabeticSort[RandomSample[WordList[Language->"Russian"],2000],"Russian"];

Build a tree with the sorted words:

buildOpenerViewerLevelN[words_,n_]:=Column[If[Length[#]===1,#[[1]],Replace[OpenerView[{Row[{Style[StringTake[#[[1]],n],Gray]," (",Length[#],")"}],buildOpenerViewerLevelN[#,n+1]}],OpenerView[{_,Column[{x_}]}]:>x]]&/@SplitBy[words,StringTake[#,UpTo[n]]&]]

buildOpenerViewerLevelN[russianWords,1]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Sort, paclet:ref/Sort])  ▪  (RefLink[AlphabeticOrder, paclet:ref/AlphabeticOrder])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Text Normalization, paclet:guide/TextNormalization])}, {▪(RefLinkPlain[International Character Sets, paclet:guide/InternationalCharacterSets])}, {▪(RefLinkPlain[Rearranging & Restructuring Lists, paclet:guide/RearrangingAndRestructuringLists])}, {▪(RefLinkPlain[String Manipulation, paclet:guide/StringManipulation])}, {▪(RefLinkPlain[String Operations, paclet:guide/StringOperations])}})}})