StringTools
Permute
apply a given permutation to a string
Calling Sequence
Parameters
Description
Examples
Permute( s, perm )
s
-
Maple string
perm
list of integers; permutation of 1 .. length(s)
The Permute(s, perm) command applies a given permutation perm to the string s.
The permutation perm must be a permutation of the integer , given as a list.
All of the StringTools package commands treat strings as (null-terminated) sequences of -bit (ASCII) characters. Thus, there is no support for multibyte character encodings, such as unicode encodings.
Error, (in StringTools:-Permute) [2, 1, 4, 3] is not a permutation of 1 .. 3
Error, (in StringTools:-Permute) [2, 3, 3] is not a permutation of 1 .. 3
Using combinat[permute] you can construct all permutations of a string.
AllPermutations := proc( s::string ) local p; seq( StringTools:-Permute( s, p ), p = combinat[ 'permute' ]( length( s ) ) ) end proc:
See Also
string
Download Help Document