输入为带有urldecode转码文本,输出正常文本。

//20130625 by zhangyl
private string ConvertToString(string input)
{
input = input.Replace("\\\"", "\"");
input = input.Replace("\\/", "/");
string result;
if (!input.Contains("\\u"))
{
result = input;
}
else
{
StringBuilder stringBuilder = new StringBuilder();
if (input.IndexOf("\\u") > )
{
stringBuilder.Append(input.Substring(, input.IndexOf("\\u")));
input = input.Substring(input.IndexOf("\\u"));
}
if (!string.IsNullOrEmpty(input))
{
string[] array = input.Split(new string[]
{
"\\u"
}, StringSplitOptions.RemoveEmptyEntries);
string[] array2 = array;
for (int i = ; i < array2.Length; i++)
{
string text = array2[i];
if (text.Length > )
{
string arg = text.Substring();
stringBuilder.Append((char)int.Parse(text.Substring(, ), NumberStyles.HexNumber) + arg);
}
else
{
if (text.Length == )
{
stringBuilder.Append((char)int.Parse(text, NumberStyles.HexNumber));
}
else
{
if (text.Length < && text.Length > )
{
stringBuilder.Append(text);
}
}
}
}
}
result = stringBuilder.ToString();
}
return result;
}

urldecode解码方法的更多相关文章

  1. [LeetCode] Decode Ways 解码方法

    A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' - ...

  2. 关于URLEncoder的编码和URLDecode解码

    在我们开发中,很多时候会遇见各种编码乱码的问题,其实这都是编码不一致的问题,如果你懂得了关于URLEncoder的编码和URLDecode解码,那么问题就会随之消失! 下面我们看看关于编码的代码: [ ...

  3. C#中Base64之编码,解码方法

    原文:C#中Base64之编码,解码方法 1.base64  to  string string strPath =  "aHR0cDovLzIwMy44MS4yOS40Njo1NTU3L1 ...

  4. [LeetCode] Decode Ways II 解码方法之二

    A message containing letters from A-Z is being encoded to numbers using the following mapping way: ' ...

  5. [Swift]LeetCode91. 解码方法 | Decode Ways

    A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' - ...

  6. [Swift]LeetCode639. 解码方法 2 | Decode Ways II

    A message containing letters from A-Z is being encoded to numbers using the following mapping way: ' ...

  7. LeetCode(91):解码方法

    Medium! 题目描述: 一条包含字母 A-Z 的消息通过以下方式进行了编码: 'A' -> 1 'B' -> 2 ... 'Z' -> 26 给定一个只包含数字的非空字符串,请计 ...

  8. leetcode 91. 解码方法 JAVA

    题目: 一条包含字母 A-Z 的消息通过以下方式进行了编码: 'A' -> 1 'B' -> 2 ... 'Z' -> 26 给定一个只包含数字的非空字符串,请计算解码方法的总数. ...

  9. 使用多字节字符集的跨平台(PC、Android、IOS、WP)编码/解码方法

    随着移动端的发展,跨平台已成为通讯架构设计的重要考虑因素,PC.Android.IOS.WP等跨多平台间的数据通讯,必然要解决字符编码/解码的问题. 多字节字符集MBCS不是跨平台的首选字符集,面向跨 ...

随机推荐

  1. [Leetcode][JAVA] Minimum Depth of Binary Tree && Balanced Binary Tree && Maximum Depth of Binary Tree

    Minimum Depth of Binary Tree Given a binary tree, find its minimum depth. The minimum depth is the n ...

  2. [转]Android开发:Parallax效果的ScrollerView,改编自ParallaxListView

    https://github.com/nirhart/ParallaxScroll这个gethub上的地址 本文转自http://www.2cto.com/kf/201502/376970.html ...

  3. IntelliLock

    IntelliLock的使用说明: http://blog.csdn.net/gnicky/article/details/20737107 http://download.csdn.net/deta ...

  4. SpringMVC入门配置和简单实现

    web.xml的配置 <!-- springmvc中央控制器 --> <servlet> <servlet-name>springmvc</servlet-n ...

  5. Go+sublime text3的环境搭建

    1.安装Go语言. .msi下载地址:http://download.csdn.net/detail/u014075041/9555543 根据提示安装成功! 在命令行中执行 go env   有提示 ...

  6. 查询指定网段可用IP脚本

    1.脚本内容: #vi hhh 添加以下内容: #!/bin/bash read -p "Please keyin the network segment: (e.g. 10.88.1) & ...

  7. LEFT JOIN 多表查询的应用

    表结构如下:只把主要字段列出 表一:付款记录表  Gather 字段:GatherID , AccountID, PayMents 金额, PayWay  付款方式 1 现金 2 刷卡 表2:销售记录 ...

  8. DataTables 控件使用和心得 (2) - 参数Options

    什么是DataTables参数(Options) 上篇我们说了,DataTables控件的加载函数dataTable()一般都有一个对象参数,这个对象参数就是整个DataTables控件的参数(Opt ...

  9. 《你必须知道的.NET》读书笔记:从Hello World认识IL

    通用的语言基础是.NET运行的基础,当我们对程序运行的结果有异议的时候,如何透过本质看表面,需要我们从底层来入手探索,这时候,IL便是我们必须知道的基础. 一.IL基础概念 1.1 什么是IL? IL ...

  10. 动态绑定HTML

    在Web前端开发中,我们经常会遇见需要动态的将一些来自后端或者是动态拼接的HTML字符串绑定到页面DOM显示,特别是在内容管理系统(CMS:是Content Management System的缩写) ...