用“拆分字符串”&引用;在VB.NET中

用“拆分字符串”&引用;在VB.NET中,vb.net,split,Vb.net,Split,假设这是我的字符串: 1 2 3 我想将字符串按“”拆分(空格),并显示字符串的每一部分。这将满足您的需要: 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 +回答得好。然而,MsgBox是对VB6的一种回馈。在.NET中使用的更好的方法是MessageBox.Show。

假设这是我的字符串:

1 2 3

我想将字符串按“”拆分(空格),并显示字符串的每一部分。

这将满足您的需要:

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

+回答得好。然而,MsgBox是对VB6的一种回馈。在.NET中使用的更好的方法是MessageBox.Show。