string str ="Planning process and execution//Rules for ramp up and ramp down//Transport//Packaging//Logistics quality//Special cost//Communication";
我必须根据"//"
分割此字符串。
目前我收到此错误:
字面上的字符过多。
答案 0 :(得分:1)
试试这个:
string str = "Planning process and execution//Rules for ramp up and ramp down//Transport//Packaging//Logistics quality//Special cost//Communication";
string[] Sep= {"//"};
var result = str.Split(Sep, StringSplitOptions.None);
答案 1 :(得分:1)
这对你有用。
string text = "Planning process and execution//Rules for ramp up and ramp down//Transport//Packaging//Logistics quality//Special cost//Communication";
string[] words = text.Split(new string[] { @"//" }, StringSplitOptions.None);
foreach (string s in words)
{
System.Console.WriteLine(s);
}
答案 2 :(得分:1)
这样做
var list = str .Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
答案 3 :(得分:1)
您可以使用正则表达式,这将在/
和//
分开:
string[] arr = Regex.Split(str, @"/+");
答案 4 :(得分:0)
试试这个
var result= str.Split(Path.AltDirectorySeparatorChar);