Page 1 of 1

Please help with a string conversion

Posted: Sun Mar 30, 2014 9:26 pm
by paris9
The output below currently gives me the hex to ascii conversion for one and a string for the other.
How can I get "A" as the result for both of the statements below?

{
:put "\41";

:local a "41";
:put "\\$a";
}

Output:
A
\41

Re: Please help with a string conversion

Posted: Mon Mar 31, 2014 4:39 am
by rextended
Simply ask!
:global tmpHex value=41;
:global funHex2Char value=[:parse (":global tmpChar value=[:put \"\\".$tmpHex."\"]")];
$funHex2Char;
:put ("\\".$tmpHex." = ".$tmpChar)
Notice: when exec $funHex2Char display one "A" (in this case) on terminal, but if used on the script, do not print anything (except if the string are launced from terminal.



If I solved your problem, please add Karma!

Re: Please help with a string conversion

Posted: Mon Mar 31, 2014 7:59 am
by paris9
Thank you! You solved my problem :D

Re: Please help with a string conversion

Posted: Mon Mar 31, 2014 9:55 am
by obadaabdullah
Simply ask!
:global tmpHex value=41;
:global funHex2Char value=[:parse (":global tmpChar value=[:put \"\\".$tmpHex."\"]")];
$funHex2Char;
:put ("\\".$tmpHex." = ".$tmpChar)
Notice: when exec $funHex2Char display one "A" (in this case) on terminal, but if used on the script, do not print anything (except if the string are launced from terminal.



If I solved your problem, please add Karma!
you r just great
respect