StringTools - Maple Programming Help

Home : Support : Online Help : Programming : Names and Strings : StringTools Package : Transformations : StringTools/Rotate

StringTools

 Rotate
 rotate the characters in a string by a given amount

 Calling Sequence Rotate( s, offset )

Parameters

 s - Maple string offset - integer; number of characters by which to rotate the string

Description

 • The Rotate(s, offset) command rotates a string s by the number of characters given in offset. The value of offset can be positive, negative, or zero. If the value of offset is zero, the original string is returned unchanged.

Examples

 > $\mathrm{with}\left(\mathrm{StringTools}\right):$
 > $\mathrm{Rotate}\left("abcde",2\right)$
 ${"deabc"}$ (1)
 > $\mathrm{Rotate}\left("abcde",22\right)$
 ${"deabc"}$ (2)
 > $\mathrm{Rotate}\left("abcde",-2\right)$
 ${"deabc"}$ (3)
 > $\mathrm{Rotate}\left("abcde",0\right)$
 ${"abcde"}$ (4)
 > $\left\{\mathrm{seq}\right\}\left(\mathrm{Rotate}\left("abcde",i\right),i=-100..100\right)$
 $\left\{{"abcde"}{,}{"bcdea"}{,}{"cdeab"}{,}{"deabc"}{,}{"eabcd"}\right\}$ (5)