IsPermutation - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.
Our website is currently undergoing maintenance, which may result in occasional errors while browsing. We apologize for any inconvenience this may cause and are working swiftly to restore full functionality. Thank you for your patience.

Online Help

All Products    Maple    MapleSim


StringTools

  

IsPermutation

  

test whether a string is a permutation

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

IsPermutation( s )

Parameters

s

-

string

Description

• 

The IsPermutation(s) command returns the value true if the string s is a permutation of its support, and returns the value false otherwise. A string is a permutation if, and only if, each character in the string occurs exactly once.

• 

Note that, since there are only 255 distinct characters (byte values), the Pigeon-Hole Principle implies that no string permutation can exceed 255 characters in length.

• 

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

withStringTools:

IsPermutation

true

(1)

IsPermutationabc

true

(2)

IsPermutationabcba

false

(3)

rrand1..10:

SseqRandomr,lower,i=1..1000:

selectIsPermutationandIsPalindrome,S

a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z

(4)

See Also

string

StringTools

StringTools[IsPalindrome]

StringTools[Support]

 


Download Help Document