在asp.net中使字符串可读 [英] Make String readable in asp.net

查看:73
本文介绍了在asp.net中使字符串可读的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi

i get value as

Situated+on+the+amazing+artificial+island+of+Palm+Jumeirah%2C+the+hotel+is+only+a+15-minute+drive+from+the+Emirates+Shopping+Centre+and+25+minutes+from+the+city+centre.+This+truly+spectacular+development+features+two+hotel+towers+linked+by+an+arch+and+is+Dubai%27s+first+truly+integrated+resort.+The+hotel+lobby+provides+a+24-hour+reception%2C+as+well+as+numerous+bars+and+restaurants.+Guests+can+also+take+advantage+of+the+hotel%27s+room+and+laundry+services.

PO+BOX+211222%2C+CRESCENT+ROAD%2C+THE+PALM%2C+DUBAI

how to make it readable (by removing all special characters)  in asp.net  and display in html page

推荐答案

Hi


试试这样..





Hi
Try like this..


static void Main(string[] args)
        {

            string input = " Situated+on+the+amazing+artificial+island+of+Palm+Jumeirah%2C+the+hotel+is+only+a+15-minute+drive+from+the+Emirates+Shopping+Centre+and+25+minutes+from+the+city+centre.+This+truly+spectacular+development+features+two+hotel+towers+linked+by+an+arch+and+is+Dubai%27s+first+truly+integrated+resort.+The+hotel+lobby+provides+a+24-hour+reception%2C+as+well+as+numerous+bars+and+restaurants.+Guests+can+also+take+advantage+of+the+hotel%27s+room+and+laundry+services. " +
   "PO+BOX+211222%2C+CRESCENT+ROAD%2C+THE+PALM%2C+DUBAI";

            string[] tokensToBeRemoved = {"+","%","-" };

             tokensToBeRemoved.ToList().ForEach(k => input = input.Replace(k, " "));

             var output = input;


        }


使用以下表达式...



Use Following Expression...

string str;
str= Regex.Replace(str, "+", " ");


这个



阅读本文




$ b可以使用$ b。
this

and read this


it may use.


这篇关于在asp.net中使字符串可读的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆