-5
我需要將所有索引從一個字符串分配給另一個字符串的所有索引。 我認爲它最好做一個for循環。分配循環中的兩個字符串的索引C#
string stdalph = "apple";
string ourkey = "cream";
StringBuilder sbalph = new StringBuilder(stdalph);
StringBuilder sbkey = new StringBuilder(ourkey);
所以像的 'A'=指數 'C'
sbalph[0] = sbkey[0];
sbalph[1] = sbkey[1];
等
希望得到任何幫助 //編輯
你們卻什麼實際的指數我需要執行的是
string stdalph = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz789";
string ourkey = "xMK6JDC18hLoYeEkBSlIyVO0niadRf9qH5N4tbWpZ3wgAuc7GQjXm2FUvTzPrs";
StringBuilder sbalph = new StringBuilder(stdalph);
StringBuilder sbkey = new StringBuilder(ourkey);
textBox2.Text = textBox1.Text;
和例如我寫的「ABC」,並把它轉換爲「XMK」
什麼是你的問題? – HimBromBeere
我不明白你的意思。 'sbalph [0] = sbkey [0]'等會複製字符串。 – Adrian
所以你想'Array.Copy()'? – vipersassassin