mIRC Home    About    Download    Register    News    Help

Print Thread
$asc() returns empty for curly braces { } #265278 26/03/19 01:08 PM
Joined: Dec 2002
Posts: 9
G
gahalle Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Dec 2002
Posts: 9
Using v7.55
`$asc({)` and `$asc(})` returns empty values instead of expected 123 or 125.

Reproduced with
`//echo * $asc({) $asc(})`

Re: $asc() returns empty for curly braces { } [Re: gahalle] #265279 26/03/19 02:51 PM
Joined: Jan 2004
Posts: 1,173
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,173
It happens with numerous string identifiers, and not for just this version.

//echo -a $asc(}) ,
//echo -a $asc({) .
result: 44 46

//echo -a $str({,5)
//echo -a $left(},5)
result: 5
//echo -a $str({,5) anything
//echo -a $left(},5) anything
result: $null

//echo -a $sha1({) abc
//echo -a $sha256(}) abc
result: same as $sha1(abc) or $sha256(abc)
//echo -a $len({) abc
result: 3

workaround is:
//echo -a $asc( $({) ) or $asc( $eval({) )
or
//var %a { | echo -a $asc({}
or the one that assumes you already know the answer
//echo -a $asc($chr(123))

You should not expect this next to be 'fixed', as brackets outside parenthesis shouldn't be used, and from the above it doesn't like them inside anything besides $() $eval():
//var %a = } | echo -a %a
//var %a = { | echo -a %a

Re: $asc() returns empty for curly braces { } [Re: maroon] #265281 26/03/19 04:21 PM
Joined: Dec 2002
Posts: 9
G
gahalle Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Dec 2002
Posts: 9
Thank you for the explanation. I was half expecting brackets to not be featured, but was made uncertain after being able to get an ascii code from doing unexpected inputs with extra characters such as for instance $asc({x).

As for what I need it to do, wrap it in $eval() does look like the way to go around this.

d-(",)z