如何使用System.Web.HttpUtility.UrlEncode as作为字符串数组转换单词
好吧也删除它 - > "!!*!!"
var array= new string []
{"windows!!1!!","dual+sim!!3!!","32+gb!!2!!","Intel+i5!!2!!","red%2fblue"};
输出数组
var Output-array= new string []
{"windows","dual sim","32 gb","Intel i5","red/blue"}
如何在C#的单行代码中执行此操作
答案 0 :(得分:3)
这是HttpUtility.UrlDecode
string[] array = new string[] { "windows!!1!!", "dual+sim!!3!!", "32+gb!!2!!", "Intel+i5!!2!!", "red%2fblue" };
string[] result = array.Select(x => System.Web.HttpUtility.UrlDecode(System.Text.RegularExpressions.Regex.Replace(x, @"!!.*!!", "")).Replace("+", " ")).ToArray();