33 lines
907 B
C#
33 lines
907 B
C#
using System;
|
||
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Text;
|
||
using System.Threading.Tasks;
|
||
|
||
namespace AllBase
|
||
{
|
||
public static class ConvertExtension
|
||
{
|
||
/// <summary>
|
||
/// 删除特殊字符 by ttzhao 2020.6.20
|
||
/// </summary>
|
||
/// <param name="text"></param>
|
||
/// <param name="characters"></param>
|
||
/// <returns></returns>
|
||
public static string RemoveSpecialChar(this string text, params string[] characters)
|
||
{
|
||
//{ ":", ":", "/", "\\", "\"", "?", "✅", "◆", "‼️" }
|
||
string str = text;
|
||
List<string> specialCharacters = new List<string>(characters);
|
||
specialCharacters.ForEach(c =>
|
||
{
|
||
if (c.Length > 0)
|
||
str = str.Replace(c, "");
|
||
});
|
||
|
||
return str;
|
||
}
|
||
}
|
||
}
|