Exchange - Maple Help

# Online Help

###### All Products    Maple    MapleSim

StringTools

 Exchange
 exchange two characters in a string

 Calling Sequence Exchange( s, m, n )

Parameters

 s - Maple string m - positive integer n - positive integer

Description

 • The Exchange( s, m, n ) command exchanges characters m and n in the string s. The integers m and n must satisfy $1\le m,n\le \mathrm{length}\left(s\right)$.
 • 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

 > $\mathrm{with}\left(\mathrm{StringTools}\right):$
 > $\mathrm{Exchange}\left("abc",1,2\right)$
 ${"bac"}$ (1)
 > $\mathrm{Exchange}\left("abc",1,3\right)$
 ${"cba"}$ (2)
 > $\mathrm{Exchange}\left("abc",3,3\right)$
 ${"abc"}$ (3)

 See Also