c# - Path functions for URL -
i want use functions of path class (getdirectoryname, getfilename, combine,etc.) paths in url format slash (/).
example of path:
"xxx://server/folder1/folder2/file"
i tried job path functions , in end replaced separator.
i've found getdirectoryname function not correctly replace slashes:
path.getdirectoryname(@"xxx://server/folder/file") -> @"xxx:\server\folder"
like see 1 slash lost.
how can cause path functions use 'alternative' separator?
can use class same functionality?
i'm afraid getdirectoryname, getfilename, combine,etc. use path.directoryseparatorchar in definition , want path.altdirectoryseparatorchar.
and since path sealed class, think way go string replacement.you can replace path.directoryseparatorchar('\') path.altdirectoryseparatorchar('/') , path.volumeseparatorchar(':') ":/"
Comments
Post a Comment