c# - How should I separate a string which contains slashes with a single slash? -



c# - How should I separate a string which contains slashes with a single slash? -

this sting this:

string = "c:\folder1\folder2\folder3";

i want separate string '\', write this:

list<string> result = a.split('\\').tolist();

but, result contains 1 member:

{c: older1 older2 older3}

i want have 4 members in result:

{c:,folder1,folder2,folder3}

so, how shold it?

the problem sample string not contain backslashes.

this string contains three:

string = "c:\\folder1\\folder2\\folder3";

or this:

string = @"c:\folder1\folder2\folder3"; // google: verbatim string literal

\f escape sequence formfeed.

c#

Comments

Popular posts from this blog

c - Compilation of a code: unkown type name string -

java - Bypassing "final local variable defined in an enclosing type" -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -