String word = textBox1.Text;
string[] test = word.Split(",,");
Run Code Online (Sandbox Code Playgroud)
如果它与一个word.Split(",");它将工作正常.但在这种情况下,字符串格式为:hello,,hi,,50,,70
我想解析它,所以在数组中我将:
hello hi 50 70
Run Code Online (Sandbox Code Playgroud)
得到错误:word.Split(",,");
错误2字符文字中的字符太多
错误3'string.Split(params char [])'的最佳重载方法匹配具有一些无效参数
错误4参数1:无法从'string'转换为'char []'
试试这个
string[] test = word.Split(new string[] { ",," }, StringSplitOptions.None);
Run Code Online (Sandbox Code Playgroud)