简体   繁体   中英

How to copy separate words from a string into an array in vb.net?

I am looking for a way to copy words from a string into an array using vb.net. I have looked at the various string manipulation options ( https://msdn.microsoft.com/en-us/library/e3s99sd8.aspx ) although I cannot figure out how to copy a word from within a string by either deleting the current word or moving onto the next word and adding each word separately into an array.

Eg

Dim Text as String = "The quick brown fox"
Dim TextArray() as String

Required output:

TextArray(0) = "The"
TextArray(1) = "quick"
TextArray(3) = "brown"
TextArray(4) = "fox"

您正在寻找的是Split()

Dim results() As String = Split(input, " ")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM