Hi, have searched on here but can only find info on splitting a string by finding certain characters.
I have a 16 character alpha numeric card number from a mifare 1k card, I need to split this every 4 characters but can't work out how.
Code uses the mifare example found on here.
I need to split either ConvertedToString or the tb_cardno.Text
Thanks.
I have a 16 character alpha numeric card number from a mifare 1k card, I need to split this every 4 characters but can't work out how.
Code uses the mifare example found on here.
B4X:
Sub Read()
Dim key(16) As Byte
Dim block_data() As Byte
Dim bc As ByteConverter
Dim sector As Int
'prepare key
Dim i As Int
For i = 0 To 15
key(i) = 255 '0xff
Next
Dim mfc As MiFare
Log("Check if the card is MF classic")
If NFC.IsMifareClassic(Activity.GetStartingIntent) Then
mfc.Initialize(Activity.GetStartingIntent)
If True = mfc.ReadSector(2,key,0) Then' Read sector 0, key, type 0(as keyA)
Log("Read sector done")
i = 8
block_data = mfc.GetBlockData(i)
StrData = bc.HexFromBytes(block_data)
Log( "data:" & StrData)
i = 8
Label1.Text = StrData
AsciiToHex (StrData)
tb_cardno.Text = ConvertedToString
End If
End If
End Sub
Sub AsciiToHex (a As String) As String
Dim bc As ByteConverter
Dim barray(0) As Byte
barray = bc.HexToBytes(a)
ConvertedToString = bc.StringFromBytes(barray,("ASCII"))
End Sub
I need to split either ConvertedToString or the tb_cardno.Text
Thanks.