-
Anonymous
Как разделить строку с помощью regex.split ()
Сообщение
Anonymous »
у меня есть одна строка, разделенная колонсами (
Код: Выделить всё
:< /code>) следующим образом: < /p>
string str = @"E:\C_Sharp\Projects\Split\test.xlsx:03/08/2016
09:12:56:file name 1,demo1.txt,date create,01/07/2016 09:12:file name
2,demo2.txt,date create,12/07/2016 14:05";
< /code>
Теперь я хочу разделить на 4 подстроения, как ниже: < /p>
str1 = @"E:\C_Sharp\Projects\Split\test.xlsx";
str2 = "03/08/2016 09:12:56"
str3 = "file name 1,demo1.txt,date create,01/07/2016 09:12"
str4 = "file name 2,demo2.txt,date create,12/07/2016 14:05"
Я использовал шаблон string pattern = @"\ d: \ d"; Но это не может.
Подробнее здесь:
https://stackoverflow.com/questions/387 ... egex-split
1758899485
Anonymous
у меня есть одна строка, разделенная колонсами ([code]:< /code>) следующим образом: < /p>
string str = @"E:\C_Sharp\Projects\Split\test.xlsx:03/08/2016
09:12:56:file name 1,demo1.txt,date create,01/07/2016 09:12:file name
2,demo2.txt,date create,12/07/2016 14:05";
< /code>
Теперь я хочу разделить на 4 подстроения, как ниже: < /p>
str1 = @"E:\C_Sharp\Projects\Split\test.xlsx";
str2 = "03/08/2016 09:12:56"
str3 = "file name 1,demo1.txt,date create,01/07/2016 09:12"
str4 = "file name 2,demo2.txt,date create,12/07/2016 14:05"
[/code]
Я использовал шаблон string pattern = @"\ d: \ d"; Но это не может.
Подробнее здесь: [url]https://stackoverflow.com/questions/38747617/how-to-split-string-using-regex-split[/url]