我试图弄清楚如何:
我有一个包含3个单词的文本框,
Word1 Word2 Word3
现在,我正在尝试寻找解决方案,方法是按按钮将上面的文本转换为此
'Word1','Word2','Word3'
最好的祝福
你可以用regx
这个
Dim s As String = TextBox1.Text '<---- here text is "Word1 Word2 Word3"
s = "'" & System.Text.RegularExpressions.Regex.Replace(s, "\s+", "'," & Chr(13) & "'") & "'"
'<---- Add ' in the begining and end
'<---- Replace n number of white spaces with ','
因此输出将是
'Word1', 'Word2', 'Word3'
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句