看板 C_Sharp 關於我們 聯絡資訊
※ 引述《liaommx (Orz)》之銘言: : 我有幾個字串, : 字串本身就是byte編碼的內容... : 假設我字串是FF,FF,FF,F1 : 我希望透過byte傳送{0xFF,0xFF,0xFF,0xF1} : 這樣,我應該怎麼解決編碼問題呢? : 用convert.tobyte都只會把它當作"字串"轉成byte.... : 這不是我要的... static void Main(string[] args) { string str = "FF,FF,FF,F1"; string[] str2 = str.Split(','); for (int i = 0; i < str2.Length; i++) { byte b = byte.Parse(str2[i], System.Globalization.NumberStyles.HexNumber); Console.WriteLine(b); } } 參考資料:http://msdn.microsoft.com/zh-tw/library/bb311038.aspx -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.117.171.46
liaommx:感謝,我研究一下 01/21 12:14
liaommx:搞定了..:P...我回文一下.. 01/21 12:28
takashi737: locationDec = (int)locationTxt.Text[0]; 01/25 17:27
takashi737:location = Convert.ToString(locationDec, 16); 01/25 17:27