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

Home
VB.Net Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statements
5.Date Time
6.Class Module
7.Development
8.Collections
9.Generics
10.Attributes
11.Event
12.LINQ
13.Stream File
14.GUI
15.GUI Applications
16.Windows Presentation Foundation
17.2D Graphics
18.I18N Internationlization
19.Reflection
20.Regular Expressions
21.Security
22.Socket Network
23.Thread
24.Windows
25.XML
26.Database ADO.net
27.Design Patterns
VB.Net
VB.Net by API
VB.Net Tutorial » Data Type » String Concatenate 
2.27.3.Create Random String from String array
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_SIZEAs Double
      Dim letters(WORD_SIZEAs String

      Dim rnd As New Random()

      For Each word As String In words
         For ctr As Integer = 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.
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.