日期:2014-05-17 浏览次数:20935 次
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
List<List<char>> simchr = new List<List<char>>()
{
new List<char>() { '0', 'o' },
new List<char>() { '2', 'z' },
new List<char>() { 'g', 'q', '9' }
};
string source = "22az9";
string source1 = string.Join("", source.Select((x, i) => simchr.Any(y => y.Any(z => z == x)) ? "{" + simchr.Single(y => y.Any(z => z == x)).FirstOrDefault() + ":" + i.ToString() + "}" : x.ToString()));
IEnumerable<string> query = new string[] { source1 };
while (Regex.IsMatch(query.First(), @"\{\w:\d+\}"))
{