123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace Bowin.Common
- {
- public static class QueryStringFormat
- {
- public static string GetFormatStr(string AStr)
- {
- if ("" == AStr)
- return "";
- else
- {
- AStr = AStr.Replace("<", "〈");
- AStr = AStr.Replace(">", "〉");
- AStr = AStr.Replace("'", "’");
- return AStr;
- }
- }//格式化字符串
- public static string GetFormatStrbjq(string AStr)
- {
- if ("" == AStr)
- return "";
- else
- {
-
- AStr = AStr.Replace("'", "’");
- return AStr;
- }
- }//格式化字符串——用编辑器的-录入的时候
- public static string GetFormatStrmb(string AStr)
- {
- if ("" == AStr)
- return "";
- else
- {
- AStr = AStr.Replace("'", "’");
- AStr = AStr.Replace("\"", "");
- return AStr;
- }
- }//格式化字符串——用编辑器的-设置模版的时候
- public static string GetFormatStrbjq_show(string AStr)
- {
- if ("" == AStr)
- return "";
- else
- {
- AStr = AStr.Replace("’", "'");
- return AStr;
- }
- }//格式化字符串——用编辑器的-显示的时候
- public static string GetFormatWorksheetName(string AStr)
- {
- if ("" == AStr)
- return "";
- else
- {
- AStr = AStr.Replace(":", " ");
- AStr = AStr.Replace(":", " ");
- AStr = AStr.Replace("/", " ");
- AStr = AStr.Replace(@"\", " ");
- AStr = AStr.Replace("?", " ");
- AStr = AStr.Replace("?", " ");
- AStr = AStr.Replace("*", " ");
- AStr = AStr.Replace("[", " ");
- AStr = AStr.Replace("]", " ");
- return AStr;
- }
- }//打印、excel导出时工作表名不能有特殊字符
- public static string TbToLb(string AStr)
- {
- if ("" == AStr)
- return "";
- else
- {
- AStr = AStr.Replace("\n", "<br>");
- AStr = AStr.Replace(" ", " ");
-
- return AStr;
- }
- }//从textbox的数据转换到lable中
- public static string GetQueryStringByPath(this Uri path, string key)
- {
- if (string.IsNullOrEmpty(path.Query))
- {
- return "";
- }
- string queryKey = key.ToLower();
- Dictionary<string, string> parameters = path.Query
- .TrimStart('?')
- .Split('&')
- .Select(x => (!string.IsNullOrEmpty(x)) ? x.Split('=').ToList() : new List<string> { "", "" })
- .ToDictionary(x => x[0].Trim().ToLower(), x => x[1].Trim());
- string value;
- if (!parameters.TryGetValue(queryKey, out value))
- {
- return "";
- }
- else
- {
- return value;
- }
- }
- }
-
- }
|