/// PathEx.RemoveLastPath("/Windows/calc.exe") // = "/Windows"
/// PathEx.RemoveLastPath("/Windows/calc.exe/") // = "/Windows"
///
/// PathEx.GetRelativePath("/Windows/System32", "/Windows/calc.exe") // = "../calc.exe"
///
/// PathEx.IsPathSeparator(char('\\')) // = true
/// PathEx.IsPathSeparator(char('/')) // = true
/// PathEx.IsPathSeparator(char('Q')) // = false
///
/// PathEx.CollapsePath("//A/../B/./C") // = "//B/C"
/// Examples (where includeDomain and wantTrailingSlash are true // unless said otherwise):
//
// \Test => \
// \\ComputerName => \\ComputerName
// \\ComputerName => \\ (if !includeDomain)
// \\ComputerName\Test => \\ComputerName\
// C:\Windows => C:\
// http://www.google.com/index.html => http://www.google.com/
// http://www.google.com/index.html => http://www.google.com (if !wantTrailingSlash)
// file:///C:/Windows => file:///C:/
// file:///C:/Windows => file:///C:/ (if !wantTrailingSlash)
// file:///C:/Windows => file:// (if !includeDomain)
// C:D:E => C:
// C:D/E => C:
// file///C:/Windows => (returns String.Empty)
// Relative/Path => (returns String.Empty)
// Hello => (returns String.Empty)
//
//
// C:\ => C:\
// C:\ => (empty string if !stopAtColon)
// http:// => http://
// test// => test//
// test/ => (empty string)
// http://www.google.ca => http://
// http://www.google.ca/ => http://
// http://www.google.ca/index.html => http://www.google.ca/
// C:\Test => C:\
// C:\A\B => C:\A\
// C:\A\B\ => C:\A\
//
// Examples might not be perfect.
//
// value of 'from_' value of 'to' return value
// --------------- ------------- ------------
// A:\B\C\D A:\B\C\D (empty string)
// A:\B\C\D A:\B\C\D\E E
// A:\B\C\D A:\B\C ..
// A:\B\C\D A:\ ..\..\.. (if requireSameRootFolder)
// A:\B\C\D A:\ A:\ (if !requireSameRootFolder)
// A/B/C A/B/D A/B/D (if !allowRelativePaths)
// A/B/C A/B/D ../D (if allowRelativePaths)
// A:\B\C\D \B\C\E \B\C\E
// \B\C\D \B\C\E ..\E
// \B\C\D \B\C\D\E\ E\
// \B\C\D \B\C\E\ ..\E\
// \B\C \D\E\ C:\D\E\ (if requireSameRootFolder)
// \B\C \D\E\ ..\..\D\E\ (if !requireSameRootFolder)
// http://W/X http://Y/Z http://Y/Z
// http://W/X http://W/Y http://W/Y (if requireSameRootFolder)
// http://W/X http://W/Y ../Y (if !requireSameRootFolder)
//
// Input Output
// ----- ------
// C:\Test C:\Test
// \Hello\.. \
// \Hello\..\ \
// Hello\.. (empty string)
// Hello\. Hello\
// A\.\B\.\C\ A\B\C\
// A\..\B\C B\C
// \\A\..\B\C \\B\C
// http://test/.. http://
//