gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-05 08:13:32 26 4
gpt4 key购买 nike

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

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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com