IsMonotonic - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.

Online Help

All Products    Maple    MapleSim


StringTools

  

IsMonotonic

  

test whether a string is monotonic

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

IsMonotonic( s )

Parameters

s

-

string

Description

• 

The IsMonotonic(s) command returns the value true if s is monotonic, and the value false otherwise. A string is monotonic if the sequence of characters it comprises is non-increasing or non-decreasing, when the characters are identified with their ASCII code points.

• 

Every string can be factored into a product (concatenation) of monotonic substrings by using StringTools[MonotonicFactors].

• 

If s is the empty string, the command returns true.

• 

All of the StringTools package commands treat strings as (null-terminated) sequences of 8-bit (ASCII) characters.  Thus, there is no support for multibyte character encodings, such as unicode encodings.

Examples

> 

with⁡StringTools:

> 

IsMonotonic⁡

true

(1)
> 

IsMonotonic⁡aaa

true

(2)
> 

IsMonotonic⁡abc

true

(3)
> 

IsMonotonic⁡cba

true

(4)
> 

IsMonotonic⁡cab

false

(5)
> 

IsMonotonic⁡abcba

false

(6)
> 

andmap⁡IsMonotonic,MonotonicFactors⁡Random⁡1000,lower

true

(7)

See Also

string

StringTools

StringTools[MonotonicFactors]