Is there a convenient function to regularize a file path in c#?
I have a command-line program which accepts a file path from the user. If they are being too clever, they might supply something like "c:\\mypath", which c# represents internally as "c:\\\\mypath"
I'd like to process the paths so they are regularized to "c:\\mypath"
I could use a string replace where I replace "\\\\" with "\\", but is there a more elegant platform independent way?
use Path. it will handle it for you and will provide you all the functionality you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With