This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Hex manipulation
#3
(18.09.2016, 21:31)Erwin van der Zwart Wrote: Hi Buuuuudzik,

Try this:

Code:
-- String to HEX
strvalue = 'this is my string'
result = lmcore.strtohex(strvalue)
log(result)

-- HEX to String
hexvalue = '74686973206973206D7920737472696E67'
result = lmcore.hextostr(hexvalue)
log(result)

-- Remove last 2 chars (or checksum)
strvalue = 'this is my string'
result = string.sub(strvalue, 0, (string.len(strvalue) -2))
log(result)

BR,

Erwin

Hey Erwin,

thanks for your help but unfortunately it not works probably because I can't use hex in this way:
Code:
hexvalue = '74686973206973206D7920737472696E67'


but only in this way:
Code:
command = string.char(0xBF,0xF4,0xFA,0xB8,0x43,0xFA,0x00,0x00,0x00,0x04,0xA2)


Is there any way to convert such data to string?

Attached Files Thumbnail(s)
   
Reply


Messages In This Thread
Hex manipulation - by buuuudzik - 18.09.2016, 14:35
RE: Hex manipulation - by Erwin van der Zwart - 18.09.2016, 21:31
RE: Hex manipulation - by buuuudzik - 19.09.2016, 12:12
RE: Hex manipulation - by Erwin van der Zwart - 19.09.2016, 12:42
RE: Hex manipulation - by admin - 19.09.2016, 12:44
RE: Hex manipulation - by buuuudzik - 19.09.2016, 13:36
RE: Hex manipulation - by Erwin van der Zwart - 19.09.2016, 15:04
RE: Hex manipulation - by admin - 19.09.2016, 15:07
RE: Hex manipulation - by buuuudzik - 19.09.2016, 16:15

Forum Jump: