Search code examples
stringvb6

Split string by a space


I have one string that has two words in it:

Cat Dog

How can I split these up so I get:

Str1 = Cat and Str2 = Dog

Please note this is for VB6.


Solution

  • Use the Split function.

    Dim output() As String
    output = Split("Cat Dog", " ")
    

    Would produce

    output(0) = Cat
    output(1) = Dog