mathjs
Version:
Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with dif
49 lines (31 loc) • 1.15 kB
Markdown
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
Compare two strings lexically. Comparison is case sensitive.
Returns 1 when x > y, -1 when x < y, and 0 when x == y.
For matrices, the function is evaluated element wise.
```js
math.compareText(x, y)
```
Parameter | Type | Description
--------- | ---- | -----------
`x` | string &
`y` | string &
Type | Description
---- | -----------
number &
```js
math.compareText('B', 'A') // returns 1
math.compareText('2', '10') // returns 1
math.compare('2', '10') // returns -1
math.compareNatural('2', '10') // returns -1
math.compareText('B', ['A', 'B', 'C']) // returns [1, 0, -1]
```
[ ](equal.md),
[ ](equalText.md),
[ ](compare.md),
[ ](compareNatural.md)