完成部门管理没实现功能
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Infrastructure.Extensions
|
||||
{
|
||||
@@ -26,5 +27,19 @@ namespace Infrastructure.Extensions
|
||||
{
|
||||
return !string.IsNullOrEmpty(str);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 注意:如果替换的旧值中有特殊符号,替换将会失败,解决办法 例如特殊符号是“(”: 要在调用本方法前加oldValue=oldValue.Replace("(","//(");
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <param name="oldValue"></param>
|
||||
/// <param name="newValue"></param>
|
||||
/// <returns></returns>
|
||||
public static string ReplaceFirst(this string input, string oldValue, string newValue)
|
||||
{
|
||||
Regex regEx = new Regex(oldValue, RegexOptions.Multiline);
|
||||
return regEx.Replace(input, newValue == null ? "" : newValue, 1);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user