[英]How to split string variable by multiple characters
I need to split string variable by multiple characters, in my case by " "
; 我需要将字符串变量拆分为多个字符,在我的情况下,应使用" "
; Here is my code: 这是我的代码:
string s_var = "New String variable";
string[] s_mas = s_var.Split(" ");
The Split() method isn't working for me, it says that the argument " "
is invalid. Split()方法不适用于我,它说参数" "
无效。 Hoping you guys know how to solve this issue. 希望你们知道如何解决这个问题。
You're not specifying the correct arguments. 您没有指定正确的参数。
Try this: 尝试这个:
var s_mas = s_var.Split(new[] { " " }, StringSplitOptions.None);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.