Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

stringlib::order

Sorting procedure for Sort

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

Syntax

stringlib::order(options)

Description

stringlib::order() returns a procedure that compares two strings and returns TRUE when they are in lexicographical order, otherwise FALSE. This procedure can be used as the second argument of sort.

Examples

Example 1

Sort strings in lexicographical order:

sort(["ab", "a", "abc", "B", "ba", "Ca", "bB", "bb"],
     stringlib::order())

Sort strings in lexicographical order without case sensitivity:

sort(["ab", "a", "abc", "B", "ba", "Ca", "bB", "bb"],
     stringlib::order(Nocase))

Sort strings in reverse lexicographical order:

sort(["ab", "a", "abc", "B", "ba", "Ca", "bB", "bb"],
     stringlib::order(Reverse))

Sort strings in reverse lexicographical order without case sensitivity:

sort(["ab", "a", "abc", "B", "ba", "Ca", "bB", "bb"],
     stringlib::order(ReverseNocase))

Options

Lexicographical

Return a procedure that yields TRUE when the two given strings are in lexicographical order.

Nocase

Return a procedure that yields TRUE when the two given strings are in lexicographical order without case sensitivity.

Reverse

Return a procedure that yields TRUE when the two given strings are in reverse lexicographical order.

ReverseNocase

Return a procedure that yields TRUE when the two given strings are in reverse lexicographical order without case sensitivity.

Return Values

Procedure that can be used as second argument of sort

See Also

MuPAD Functions

Was this topic helpful?