X = 999;
String$ = CHR(X/256) + CHR(X%256);
That's off the top of my head - should do it... "%" is short for MOD aka "modulus".
- Chip
toggle quoted message
Show quoted text
--- In Crestron@..., "prunier514" <jerome.homeprog@...> wrote:
Perfect, thx.
Know, I need to do the same process but in the other way... :
Example:
I have an integer i = 999d ans i would like put this value in a string with 2 bytes....like string s = \x03\xE7 .
Any suggestions?
Thx again for your time
--- In Crestron@..., "Steve Kaudle" <skaudle@> wrote:
You could convert your example string to an integer with
i=(byte(s,1)*256)+byte(s,2);
If 's' = the string "\x03\xE7", then integer 'i' would = 03E7h or 999d,
depending on how one wishes to look at it. No need for further conversion,
assuming I'm understanding your intent.
From: Crestron@... [mailto:Crestron@...] On Behalf
Of prunier514
Sent: Tuesday, June 04, 2013 4:52 PM
To: Crestron@...
Subject: [Crestron] Simpl+ hex manipulation
Hi guys,
First,I have a string. For example: string stringtest = "\x03\xE7";
Finally: I want take the both hex value of stringtest to put together (so, I
want 03E7)and convert this value in an integer to have 999 at the end.
Any suggestions?
Thx for time
[Non-text portions of this message have been removed]