seri #5653(2008/02/02 18:22 GMT) [ C# ] Rating0/0=0.00
(1)基本版です。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
using System; using System.Collections.Generic; class Program { static void Main(string[] args) { Console.WriteLine(Tr("qwertyuiop", "QWERTYUIOP", "typewriter")); } static string Tr(string from, string to, string target) { char[] result = new char[target.Length]; Dictionary<char, char> table = new Dictionary<char, char>(); for (int i = 0; i < from.Length && i < to.Length; i++) table[from[i]] = to[i]; for (int i = 0; i < target.Length; i++) { char c = target[i]; result[i] = (table.ContainsKey(c)) ? table[c] : c; } return new string(result); } }
Rating0/0=0.00-0+
[ reply ]
seri
#5653()
[
C#
]
Rating0/0=0.00
Rating0/0=0.00-0+
[ reply ]