Quote Originally Posted by SeanGrebey View Post
Use strA.Length - 1 to find the index of the last word instead of assuming 1.
Thank you sir for replying

I already have a code written to get the last three words of a string and jumble the words in one way.

Code:
Dim str As String = Me.t1.Text

        Dim strA() As String = str.Split(" ")

        If strA.Length > 2 Then
            Dim a As String = (strA(strA.Length - 3) + " " + strA(strA.Length - 2) + " " + strA(strA.Length - 1))
            Dim a2() As String = a.Split(" ")
            Dim ne(100) As String
            ne(0) = a2(1)
            ne(1) = a2(2)
            ne(2) = a2(0)
            MessageBox.Show(ne(0) + " " + ne(1) + " " + ne(2))
        End If
I know it is not a very good code.Pardon my coding knowledge.
I want a code that does the above procedure no matter how many words are entered.I want to get the maximum number of results.Like with 3 words I should get 6 possible strings