List.Sort
---------

Sorts the list.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [List](component_List.md) | [4.2](newinversion42.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "List.Sort"; List { ; Flags; NoReturnEnding } ) 

**MBS**( **"List.Sort";** /\* Sorts the list. \*/  
**$List**; /\* The list to sort.e.g. "Hello" ¶ "World" \*/   
**$Flags**; /\* Optional; Optional, whether to sort case insensitive or descending.   
Pass 1 to sort case insensitive or 0 to sort case sensitive.   
Add 2 to sort descending.  
Add 4 for sorting dates in DD.MM.YYYY style and 8 for sorting dates in MM.DD.YYYY style.  
Add 16 for number sorting (new in 7.5).e.g. 1 \*/   
**$NoReturnEnding**) /\* Optional; Pass 1 to have no extra newline character on the end of the returned list. Default is 0 to include one to easily concat lists.e.g. 1 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| List | The list to sort. | "Hello" ¶ "World" |  |
| Flags | Optional, whether to sort case insensitive or descending.    Pass 1 to sort case insensitive or 0 to sort case sensitive.    Add 2 to sort descending.   Add 4 for sorting dates in DD.MM.YYYY style and 8 for sorting dates in MM.DD.YYYY style.   Add 16 for number sorting (new in 7.5). | 1 | Optional |
| NoReturnEnding | Pass 1 to have no extra newline character on the end of the returned list. Default is 0 to include one to easily concat lists. | 1 | Optional |

### Result

Returns new list.

### Description

Sorts the list.  
Version 6.2 adds new modes for date sorting. Mode 4 for DD.MM.YYYY style and mode 8 for MM.DD.YYYY style.  
Version 7.5 adds number sorting.  
### Examples

Sort case sensitive:

 MBS ( "List.Sort"; "Hello¶World¶Test" )  
Sort case insensitive:

 MBS ( "List.Sort"; "Hello¶World¶test"; 1 )  
Sort case sensitive and descending:

 MBS ( "List.Sort"; "Hello¶World¶Test"; 2 )  
Sort case insensitive and descending:

 MBS ( "List.Sort"; "Hello¶World¶test"; 3 )  
Sort German dates:

 Show Custom Dialog \[MBS ("List.Sort"; "01.01 .2001¶12.04 .1981¶01.04 .1981¶12.07 .1981¶12.01 .1981¶23.11 .2014"; 4; 0)\]  
Sort US dates:

 Show Custom Dialog \[MBS ("List.Sort"; "01/01/2001¶04/12/1981¶04/01/1981¶07/12/1981¶01/12/1981¶11/23/2014"; 8; 0)\]  
Sort numbers

 MBS ( "List.Sort"; "1¶555¶7"; 16 )  
<small>  
Example result:   
"1  
7  
555  
"</small>### See also

- [Files.List](FilesList.md)
- [FontManager.ListFontFamilies](FontManagerListFontFamilies.md)
- [FontManager.ListFonts](FontManagerListFonts.md)
- [List.Not](ListNot.md)
- [List.SortWithEvaluate](ListSortWithEvaluate.md)
- [QuickList.DeCombine](QuickListDeCombine.md)
- [QuickList.Sort](QuickListSort.md)
- [QuickList.SortWith](QuickListSortWith.md)
- [QuickList.SortWithEvaluate](QuickListSortWithEvaluate.md)

### Release notes

- **Version 11.0**
    - Added mode 16 for number sorting to [QuickList.SortWith](https://www.mbsplugins.eu/QuickListSortWith.shtml) function.
- **Version 10.2**
    - Added [List.SortWithEvaluate](https://www.mbsplugins.eu/ListSortWithEvaluate.shtml) and [QuickList.SortWithEvaluate](https://www.mbsplugins.eu/QuickListSortWithEvaluate.shtml) functions to sort lists with custom expression.
- **Version 8.3**
    - Improved [List.Sort](http://www.mbsplugins.eu/ListSort.shtml) to better sort numbers.
- **Version 7.5**
    - Added number sort mode for [List.Sort](http://www.mbsplugins.eu/ListSort.shtml).

### Example Databases

- [List/List Sorting](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/List/List%20Sorting.shtml#1GroupButton48.0000000876.000000073.00000001027.0000000LayoutObjectAnchor_)
- [List/Sort Benchmark](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/List/Sort%20Benchmark.shtml#4ScriptAnchor_)
- [Text functions/Lists](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Text%20functions/Lists.shtml#5ScriptAnchor_)

### Blog Entries

- [Sort with evaluate in FileMaker](https://www.mbsplugins.de/archive/2020-04-10/Sort_with_evaluate_in_FileMake/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 8.3pr2](https://www.mbsplugins.de/archive/2018-06-18/MBS_FileMaker_Plugin_version_8/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 7.5pr5](https://www.mbsplugins.de/archive/2017-11-01/MBS_FileMaker_Plugin_version_7/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 6.2pr1](https://www.mbsplugins.de/archive/2016-03-19/MBS_FileMaker_Plugin_version_6/monkeybreadsoftware_blog_filemaker)
- [New functions for MBS FileMaker Plugin coming soon](https://www.mbsplugins.de/archive/2016-03-17/New_functions_for_MBS_FileMake/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin, version 4.4pr4](https://www.mbsplugins.de/archive/2014-10-06/MBS_Filemaker_Plugin_version_4/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin, version 4.4pr3](https://www.mbsplugins.de/archive/2014-10-01/MBS_Filemaker_Plugin_version_4/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 18th August 2014 , last changed 1st November 2017

  
[List.Shuffle](ListShuffle.md) - [List.SortWithEvaluate](ListSortWithEvaluate.md)

[HTML Version](ListSort.shtml)