user3258734
user3258734

Reputation: 143

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.

Upvotes: 10

Views: 38439

Answers (2)

Alexander
Alexander

Reputation: 29

or like this:

For Each i In output
  .... a even here
next

Upvotes: 0

ecnepsnai
ecnepsnai

Reputation: 2026

Use the Split function.

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

Would produce

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

Upvotes: 24

Related Questions