Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有以下输入字符串str = "a,b,c,d";
str = "a,b,c,d";
期望在组中输出,例如(获取每个逗号的左右单词)
[group0 : a b] [group1 : b c] [group2 : c d]
您可以执行以下操作:
string str = "a,b,c,d"; string[] parts = str.Split(','); for (int i = 0; i < parts.Length-1; i++) System.Diagnostics.Debug.WriteLine(parts[i] + " " + parts[i+1]);
顺便说一句,你试过什么?
编辑: 对于那些对此解决方案有任何担忧的人,这里是 demo。
您可以匹配单个组并使用此正则表达式迭代匹配项:
([^,]+),([^,]+)
因此,在每场比赛中,第一组将是左词,第二组将是右词。
I am trying to ensure that each job has the correct link when a user clicks on it.
The issue I am having is that I keep getting the error Couldn't find job without an ID.
Couldn't find job without an ID
In