The stringsplit Method

This instance method on a string enables you to separate it into an array of components. For example, if you want to quickly find each of the different elements in a comma-delimited string, you could use the Split method to turn the string into an array of smaller strings, each of which contains one field of data. As shown in Figure 2-8, the csvString is converted to an array of three elements:

' String Split

Dim csvString = "Coll, Col2, Col3" Dim stringArray As String() = csvString.Split(",") TextBoxi.Text &= stringArray(O) & Environment.NewLine TextBoxi.Text &= stringArray(l) & Environment.NewLine TextBoxi.Text &= stringArray(2) & Environment.NewLine TextBoxi.Text &= line & Environment.NewLine

Code snippet from Forml

Was this article helpful?

0 0

Post a comment