StringTools - Maple Programming Help

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

StringTools

 Shift
 shift the characters in a string by a given amount

 Calling Sequence Shift( s, shift )

Parameters

 s - Maple string shift - integer; shift amount

Description

 • The Shift(s, shift) command shifts the characters in a string s by the amount given by shift. The value of shift can be positive, negative, or zero. If the value of shift is zero modulo $256$, the original string is returned unchanged.

Examples

 > $\mathrm{with}\left(\mathrm{StringTools}\right):$
 > $\mathrm{Shift}\left("abcde",2\right)$
 ${"cdefg"}$ (1)
 > $\mathrm{Shift}\left("abcde",258\right)$
 ${"cdefg"}$ (2)
 > $\mathrm{Shift}\left("abcde",-2\right)$
 ${"_abc"}$ (3)
 > $\mathrm{Shift}\left("abcde",0\right)$
 ${"abcde"}$ (4)
 > $\mathrm{seq}\left(\mathrm{Shift}\left("abcde",i\right),i=-5..5\right)$
 ${"\\right]^_"}{,}{"\right]^_a"}{,}{"^_ab"}{,}{"_abc"}{,}{"abcd"}{,}{"abcde"}{,}{"bcdef"}{,}{"cdefg"}{,}{"defgh"}{,}{"efghi"}{,}{"fghij"}$ (5)