Formats the path.
using System;
using System.Collections.Specialized;
using System.Xml;
using System.Text;
using System.Text.RegularExpressions;
namespace RSBuild
{
/// <summary>
/// Utility methods.
/// </summary>
public static class Util
{
/// <summary>
/// Formats the path.
/// </summary>
/// <param name="input">The input.</param>
/// <returns></returns>
public static string FormatPath(string input)
{
if (input != null && input.Trim().Length > 0)
{
string output = input.Replace("\\", "/");
if (!output.StartsWith("/"))
{
output = string.Format("/{0}", output);
}
if (output.EndsWith("/"))
{
output = output.Substring(0, output.Length-1);
}
return output;
}
else
{
return "/";
}
}
}
}
Related examples in the same category