vb.net - 如何拆分逗号分隔的字符串?

标签 vb.net

我有一个逗号分隔的字符串。

e.g. {"one,two,three"} 

任何人都可以告诉我是否可以从中创建一个数组,如果可以,如何创建?在 VB.net 中。

最佳答案

    ' you want to split this input string
    Dim s As String = "one,two,three"

    ' Split string based on comma
    Dim words As String() = s.Split(New Char() {","c})

    ' Use For Each loop over words and display them

    Dim word As String
    For Each word In words
        Console.WriteLine(word)
    Next

关于vb.net - 如何拆分逗号分隔的字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27035042/

相关文章:

vb.net - LINQ to Objects - 不是在吗?

.net - 将多个参数传递给多个线程

vb.net - 当 T 是值类型时,从字符串转换为泛型类型 T 的更快方法?

vb.net - Visual Studio 2005 for VB 中的重构功能

c# - 是否可以将新的 C# 页面添加到现有的 VB.Net 网站?

vb.net - 按值对字典排序

mysql - BCrypt 验证存储的密码哈希

vb.net - 如何获取当前时间戳

javascript - 如何获得屏幕宽度和高度的解决方案?

VB.NET在继续读取/写入之前检查文件是否打开?