相关疑难解决方法(0)

如何使用Regex.Replace一次替换两个字符串?

我有以下方法从文件名替换"磅"符号,但我也希望能够同时替换"单撇号".我该怎么做?这是filename = Provider license_A'R_Ab#acus Settlements_1-11-09.xls的值

static string removeBadCharPound(string filename)
{            // Replace invalid characters with "_" char.            
    //I want something like this but is NOT working 
    //return Regex.Replace(filename, "# ' ", "_");
    return Regex.Replace(filename, "#", "_");
 }
Run Code Online (Sandbox Code Playgroud)

c# regex replace

2
推荐指数
2
解决办法
2万
查看次数

标签 统计

c# ×1

regex ×1

replace ×1