7

Let’s say that this is my string:

1 2 3

I want to split the string by " " (space) and display every time part of my string.

1 Answer 1

20

This will do what you need:

Dim str As String = "1 2 3"
Dim strarr() As String
strarr = str.Split(" "c)
For Each s As String In strarr
    MessageBox.Show(s)
Next
Sign up to request clarification or add additional context in comments.

1 Comment

+1 Good answer. MsgBox, however, is a throw-back to VB6. The better method to use in .NET is MessageBox.Show.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.