如何在vb 2010中拆分字符串或制作字符

时间:2012-03-25 11:54:17

标签: string split chars

我搜索但没有解释如何做到这一点, 例如

Dim sentence as String = "cat is an animal"

如果我制作一个msgbox:

MsgBox(sentence)

显示

cat is an animal

如何制作一个说明

的msgbox
cat
is
an
animal.

1 个答案:

答案 0 :(得分:0)

简单方法用新线替换空间

,如字符串中的单词= MyString.Replace(" ","\r\n")

拆分将在空间中拆分为一个数组,然后用新行连接备份,这是没有意义的,除非你需要其他的数组。