Skip to content

Instantly share code, notes, and snippets.

@maksadbek
Created October 21, 2013 10:47
Show Gist options
  • Save maksadbek/7081938 to your computer and use it in GitHub Desktop.
Save maksadbek/7081938 to your computer and use it in GitHub Desktop.
Public Class Form1
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles tbxIn.TextChanged
End Sub
Private Sub btnTr_Click(sender As Object, e As EventArgs) Handles btnTr.Click
Dim textInput As String = tbxIn.Text
Dim len As Integer = textInput.Length
Dim textHead As String
Dim textOutput As String
Dim textTail As String
If (len Mod 2 = 0) Then
textHead = textInput.Substring(0, len / 2)
textTail = textInput.Substring(len / 2)
textOutput = textTail & textHead
tbxOut.Text = textOutput
Else
textHead = textInput.Substring(0, (len / 2) - 0.5)
textTail = textInput.Substring((len / 2) - 0.5)
textOutput = textTail & textHead
tbxOut.Text = textOutput
End If
End Sub
End Class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment