Comment detail

文字変換表に基く文字列の変換 (Nested Flatten)

続いて(1)基本版です。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
//http://ja.doukaku.org/148/ 投稿用
using System;
static class Program {
    static string Tr(this string target, string from, string to) {
        for(int i = 0; i < from.Length; i++) {
            target = target.Replace(from[i], to[i]);
        }
        return target;
    }

    static void Main(string[] args) {
        Console.WriteLine("typewriter".Tr("qwertyuiop", "QWERTYUIOP"));
        Console.ReadLine();
    }
}

Index

Feed

Other

Link

Pathtraq

loading...