![](/img/trans.png)
[英]How to converting a string of Binary numbers into a string of Decimal numbers?
[英]Converting string with letters and numbers to decimal only numbers
我正在使用RFID Reader
,后來成為一個軟件演示,該演示具有讀取rfid tag
幾種不同類型,例如:
Hexadecimal
, Decimal
, Ascii
, Abatrack
等...
Abatrack
文檔說:
Shows the CardID converted to decimal with 14 digits
。
我有一個01048CABFB
= 01048CABFB
然后使用此協議,它向我顯示00004371295227
where the first four zeroes were added by the software
它將包含字母和數字的string
轉換為僅包含數字的decimal
。 我該怎么辦?
我發現此 ,但它在VB
。
要將十六進制轉換為十進制,可以執行以下操作:
string hexString = "01048CABFB";
long intVal = Int64.Parse(hexString, System.Globalization.NumberStyles.HexNumber);
// intVal = 4371295227
您還可以使用Convert.ToInt64(),它允許您指定以16為基數(十六進制):
string hexFromRFID = "01048CABFB";
Int64 decFromRFID = Convert.ToInt64(hexFromRFID, 16);
Console.WriteLine("Hex: " + hexFromRFID + " = Dec: " + decFromRFID);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.