convert path to UNIX path

Convert all backward slashes into forward slashes.

Download tounixpath.zip

Synopsis:

tounixpath.cs


tounixpath.cs

Synopsis
using ut;

public class testtounixpath
{
  public string toUnixPath(string path)
  {
    return path.Replace(@"\", @"/");
  }

  public void test_identities()
  {
    utx.assert(toUnixPath(""), "");
    utx.assert(toUnixPath("x"), "x");
    utx.assert(toUnixPath(@"c:/x"), @"c:/x");
  }

  public void test_1()
  {
    utx.assert(toUnixPath(@"x\y"), @"x/y");
    utx.assert(toUnixPath(@"\y"), @"/y");
    utx.assert(toUnixPath(@"x\"), @"x/");
    utx.assert(toUnixPath(@"c:x\"), @"c:x/");
    utx.assert(toUnixPath(@"\"), @"/");
  }
}






Contact me about content on this page using john_web-at-arrizza-dot-com
For Web Master or site problems contact: webadmin-at-arrizza-dot-com
Copyright John Arrizza (c) 2001,2002,2003,2004,2005,2006,2007