转码(to 16)

{
        public Form1()
        {
            InitializeComponent();
        }

        private void btnconvert_Click(object sender, EventArgs e)
        {
            rchout.Text = "";
            string str = txtinput.Text.Trim();
            //转16进制
            char[] values = str.ToCharArray();
            foreach (char letter in values)
            {
                int value = Convert.ToInt32(letter);
                string s = string.Format("{0:X}", value);
                rchout.Text += "\\x" + s;
            }

        }
    }

 

你可能感兴趣的:(转码)