ITSourceCode.com

We Exist to Provide 100% Free Source Code and Tutorials

Custom Search

34-Splitting Strings

Split is a function that separates Strings. It receives a string or character delimiter that parses and separates the string into parts.

 

Example:

  1. Dim textLine As String
  2. Dim textArray() As String
  3. 'set a line of text
  4. textLine = "UserName1 Password1 UserName2 Password2"
  5. 'pass it to the array and split it with space
  6. textArray = textLine.Split(" ")
  7.  
  8. 'its segregate the line of text in an array
  9. For i As Integer = 0 To UBound(textArray)
  10.  
  11. MsgBox(textArray(i))
  12.  
  13. Next i

or

  1. Dim textLine As String
  2. Dim textArray() As String
  3. 'set a line of text
  4. textLine = "UserName1, Password1, UserName2, Password2"
  5. 'pass it to the array and split it with comma
  6. textArray = textLine.Split(",")
  7.  
  8. 'its segregate the line of text in an array
  9. For i As Integer = 0 To UBound(textArray)
  10.  
  11. MsgBox(textArray(i))
  12.  
  13. Next i
Facebook Comments

Check Your Domain Ranking

Leave a Reply

Your email address will not be published. Required fields are marked *

ITSourceCode.com © 2016 Frontier Theme

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!