Hi All,
I need to convert string which I get from a textbox to an array.
string = "abcd"
will need as hex (array) to sent through comPort
result should be = [61 62 63 64]
thanks for helps
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Francis SusaimichaelRank #466 · 5.4K reputationPosted Dec 25, 2015, 8:54 AM EST
byte[] b = Encoding.Default.GetBytes(str);
var hexString = BitConverter.ToString(b);
string[] hexArray = hexString.Split('-');
ilhami caliskan79 reputationPosted Dec 25, 2015, 9:49 AM EST