Example #1
0
 /// <summary>
 /// URL格式化
 /// </summary>
 /// <param name="InputStr">输入字符串</param>
 /// <returns>格式化后的URL</returns>
 public static string URLFormat(string InputStr)
 {
     if (VerifyManager.IsURL(InputStr))
     {
         ReplaceStringModel rsm = new ReplaceStringModel(@"\", @"/");
         return(Replace(InputStr, rsm));
     }
     return(string.Empty);
 }
Example #2
0
 /// <summary>
 /// 路径格式化
 /// </summary>
 /// <param name="InputStr">输入的字符串</param>
 /// <returns>格式化后的Path</returns>
 public static string PathFormat(string InputStr)
 {
     if (VerifyManager.IsAbsolutePath(InputStr) || VerifyManager.IsRelativePath(InputStr))
     {
         ReplaceStringModel rsm = new ReplaceStringModel(@"/", @"\");
         InputStr = Replace(InputStr, rsm);
         return(RemvoePathLastChar(InputStr));
     }
     return(string.Empty);
 }
Example #3
0
 /// <summary>
 /// 替换字符串
 /// </summary>
 /// <param name="InputStr">输入字符串</param>
 /// <param name="rsm">需要替换的对象</param>
 /// <returns>替换后的字符串</returns>
 public static string Replace(string InputStr, ReplaceStringModel rsm)
 {
     return(InputStr.Replace(rsm.OldStr, rsm.NewStr));
 }