Question: I'm trying to shift letters to the end of the word. Like the sample output I have in the image.
[![Sample output](https://i.stack.imgur.com/BofY1.png)](https://i.stack.imgur.com/BofY1.png)
Using getchar and remove function, I was able to shift 1 letter. 

```
        mychar = GetChar(word, 1)   'Get the first character
        word = word.Remove(0, 1)  'Remove the first character
        input.Text = mychar         
        word = word & mychar
        output.Text = word

```

This is my code for shifting 1 letter.
I.E. for the word 'Star Wars', it currently shifts 1 letter, and says 'tar WarsS'

How can I make this move 3 characters to the end? Like in the sample image.

Answer: 
```
intNumChars = input.text

output.text = mid(word,4,len(word)) & left(word,3)

```

I wanted it to be easy for you to read but you can set the intNumChars variable to the value in your text box and replace the 4 with intNumChars + 1 and the 3 with intNumChars.

The mid() function can return a section of text in the middle of a string mid(string,start,finish). The len() function returns the length of a string so that the code will work on texts that are different lengths. The left function returns characters from the left() of a string.

I hope this is of some help.
You could write a that as a sort of permute, which maps each char-index to a new place in the range `[0, textLength[`

In order to do that you'll have to write a custom modulus as the `Mod` operator is more a remainder than a modulus (from a mathematical point of view, regarding how negative are handled)

With that you just need to loop over your string indexes and map each one to it's "offsetted" value modulo the length of the text

```
' Can be made local to Shift method if needed
Function Modulus(dividend As Integer, divisor As Integer) As Integer
    dividend = dividend Mod divisor
    Return If(dividend < 0, dividend + divisor, dividend)
End Function

Function Shift(text As String, offset As Integer) As String
    ' validation omitted
    Dim length = text.Length
    Dim arr(length - 1) As Char

    For i = 0 To length - 1
        arr(Modulus(i + offset, length) Mod length) = text(i)
    Next

    Return new String(arr)
End Function

```

That way you can easily handle negative values or values greater than the length of the text.

Note, the same thing is possible with a `StringBuilder` instead of an array ; I'm not sure which one is "better"

```
Function Shift(text As String, offset As Integer) As String
    Dim builder As New StringBuilder(text)
    Dim length = text.Length

    For i = 0 To length - 1
        builder(Modulus(i + offset, length) Mod length) = text(i)
    Next

    Return builder.ToString
End Function

```