Create Random String from String array : String Concatenate « Data Type « VB.Net Tutorial






Imports System.Collections

Module Example
   Public Sub Main()
      Const WORD_SIZE As Integer = 4
      Dim words() As String = { "1234", "5678", "90qw", "qwer" }

      Dim keys(WORD_SIZE) As Double
      Dim letters(WORD_SIZE) As String

      Dim rnd As New Random()

      For Each word As String In words
         For ctr As Integer = 0 To word.Length - 1

            keys(ctr) = rnd.NextDouble()

            letters(ctr) = word.Chars(ctr)
         Next   

         Array.Sort(keys, letters, 0, WORD_SIZE, Comparer.Default)      

         Dim scrambledWord As String = String.Concat(letters(0), letters(1), letters(2), letters(3))
         Console.WriteLine(word)
         Console.WriteLine(scrambledWord)
      Next 
   End Sub
End Module








2.27.String Concatenate
2.27.1.String Concatenate
2.27.2.Use the overloaded operator
2.27.3.Create Random String from String array
2.27.4.Concat method with a String array.