I'm trying to split a string
that represents a filepath, so the path contains pictures. For example should the pathstring #c:\users\common\pictures\2008
be converted to pictures\2008
. The problem that I encounter is that when I use \
in a string it gives me an error. Sorry for the dumb question, m new with C#. This is what I've done so far:
string path = "#c:\users\common\pictures\2008";
string[] subs = path.Split('\');
int count = 0;
while(subs[count] != "pictures")
{
count++;
}
string newPath = "";
for (int i = count; i < subs.Length; i++)
{
newPath += "\" + subs[i];
}
Console.WriteLine(newPath);