I have a string with a path that looks like this:
"Salle de bains / 01-Points d'eau / 01-01 Vasques"
Now I want to change this path to look like this:
"Salle de bains/01-Points d'eau/01-01 Vasques"
I already tried Trim, Replace, and Substring without success. I then tried this method:
private string UrlCreator(string dir)
{
string dirFinish = dir;
foreach(Char item in dirFinish)
{
if (Char.IsWhiteSpace(item) && ((item-1).Equals('/') || (item+1).Equals('/')))
{
string charToChange = item.ToString();
charToChange = "";
}
else { }
}
return dirFinish;
}
But this doesn't give me the desired result. How can I achieve this?
Using the string replace method: