CSharp examples for File IO:Path
Normalize Path String
using System.Text.RegularExpressions; using System.Text; using System.Globalization; using System.Collections.Generic; using System;/*from ww w . ja v a 2 s. co m*/ public class Main{ internal static string NormalizePath(string path) { try { path = path.Replace(':', '-'); path = path.Replace('/', '-'); //Path = Path.Replace('\\', '-'); path = path.Replace('*', '\''); path = path.Replace('?', ';'); path = path.Replace('"', '\''); path = path.Replace('<', '['); path = path.Replace('>', ']'); path = path.Replace('|', '-'); } catch (Exception e) { Debugger.LogMessageToFile("An unexpected error occurred in the String Normalizer. " + "The error was: " + e ); } return path; } }