I write a converter for user input data, which converts number value strings and ascii characters enclosed in ' ' to hex representation. Number entering works fine with:
string TestText = "lorem, 'C', 127, 0x06, '#' ipsum";
TestText = Regex.Replace(
TestText,
" +\\d{1,3}",
(MatchEvaluator)(match => Convert.ToByte(match.Value).ToString("X2")));
Out.Text = TestText;
But how can I detect ascii chars enclosed in ' ' and convert them to a hex string like: 'C' will be 43 and '+' becomes 2B.