Community discussions

MikroTik App
 
paris9
newbie
Topic Author
Posts: 32
Joined: Mon Feb 03, 2014 9:31 am

Please help with a string conversion

Sun Mar 30, 2014 9:26 pm

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
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 2954
Joined: Tue Feb 25, 2014 12:49 pm
Location: Capalbio, Tuscany, Italy

Re: Please help with a string conversion

Mon Mar 31, 2014 4:39 am

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!
I'm Italian, not English. Sorry for my imperfect grammar.
 
paris9
newbie
Topic Author
Posts: 32
Joined: Mon Feb 03, 2014 9:31 am

Re: Please help with a string conversion

Mon Mar 31, 2014 7:59 am

Thank you! You solved my problem :D
 
obadaabdullah
Frequent Visitor
Frequent Visitor
Posts: 71
Joined: Wed Jan 08, 2014 7:41 pm

Re: Please help with a string conversion

Mon Mar 31, 2014 9:55 am

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

Who is online

Users browsing this forum: SiB and 9 guests