0

Hi all
my code is :

Dim s, w As String
s = "a b c 1"
w = [U]s.Split(" ")[/U]

The error is Value of type '1-dimensional array of string' cannot be converted to 'String'.
Any ideas ?

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by Luc001
0

Hi,

Here's an example how to do this.

Public Class SplitTest
    Public Shared Sub Main()
        Dim words As String = "This is a list of words, with: a bit of punctuation" + _
                              vbTab + "and a tab character."
        Dim split As String() = words.Split(New [Char]() {" "c, ","c, "."c, ":"c, CChar(vbTab) })

        For Each s As String In  split
            If s.Trim() <> "" Then
                Console.WriteLine(s)
            End If
        Next s
    End Sub 'Main
End Class
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.