c# Programming Glossary: path.directoryseparatorchar
C# Sanitize File Name http://stackoverflow.com/questions/309485/c-sharp-sanitize-file-name List string parts new List string path.Split new char Path.DirectorySeparatorChar check each part to make sure it is valid. for int i 0 i parts.Count.. replaceChar parts i part return root Utility.Join parts Path.DirectorySeparatorChar.ToString Any improvements to make this function faster and..
How to implement glob in C# http://stackoverflow.com/questions/398518/how-to-implement-glob-in-c-sharp return path summary shortcut summary static char DirSep Path.DirectorySeparatorChar summary return the first element of a file path summary param..
C# How do I extract each folder name from a path? http://stackoverflow.com/questions/401304/c-sharp-how-do-i-extract-each-folder-name-from-a-path .. folder1 folder2 folder2 string directories mypath.Split Path.DirectorySeparatorChar Edit This returns each individual folder in the directories..
Why Does Path.Combine not properly concatenate filenames that start with Path.DirectorySeparatorChar http://stackoverflow.com/questions/53102/why-does-path-combine-not-properly-concatenate-filenames-that-start-with-path-di not properly concatenate filenames that start with Path.DirectorySeparatorChar In the Immediate Window System.IO.Path.Combine @ C test @ test..
Getting path relative to the current working directory? http://stackoverflow.com/questions/703281/getting-path-relative-to-the-current-working-directory folder.MakeRelativeUri file .ToString .Replace ' ' Path.DirectorySeparatorChar As a function method string GetRelativePath string filespec.. filespec Folders must end in a slash if folder.EndsWith Path.DirectorySeparatorChar.ToString folder Path.DirectorySeparatorChar Uri folderUri new.. Path.DirectorySeparatorChar.ToString folder Path.DirectorySeparatorChar Uri folderUri new Uri folder return Uri.UnescapeDataString folderUri.MakeRelativeUri..
|