裡面的richTextBox1,2是兩個多行的文本框,richTextBox1是輸入框,richTextBox2是結果框
button5_Click 是畫面上的轉換按鈕
private void button5_Click(object sender, System.EventArgs e)
...{
this.richTextBox2.Text = "";
string tempValue = "";
foreach(char c in this.richTextBox1.Text)
...{
tempValue = ((int)c).ToString("X2").ToUpper();
if(tempValue.Length >=4)
...{
this.richTextBox2.Text += "\u"+tempValue;
}
else
...{
this.richTextBox2.Text += c.ToString();
}
}
}
}