CSharp examples for System:Hex
Hex Unescape
// Licensed under the same terms of ServiceStack: new BSD license. using System.Text; using System.Linq; using System.Collections.Generic; using System;/*w ww.j a va 2s. c o m*/ public class Main{ public static string HexUnescape(this string text, params char[] anyCharOf) { if (string.IsNullOrEmpty(text)) return null; if (anyCharOf == null || anyCharOf.Length == 0) return text; var sb = new StringBuilder(); var textLength = text.Length; for (var i=0; i < textLength; i++) { var c = text.Substring(i, 1); if (c == "%") { var hexNo = Convert.ToInt32(text.Substring(i + 1, 2), 16); sb.Append((char)hexNo); i += 2; } else { sb.Append(c); } } return sb.ToString(); } }