AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   javascript unescape ? (https://forums.alliedmods.net/showthread.php?t=128368)

ÜnLoCo 05-31-2010 11:03

javascript unescape ?
 
hello guys i have 'for example' this string (\u00dcnLoco) and i want to make it (ÜnLoco) and show it in a motd !

in javascript it's just unescape("\u00dcnLoco")

Firebug output
PHP Code:

>>> unescape("\u00dcnLoco")
"ÜnLoco" 

is there anyway to do the same with amxx ? at least is there a way to play with ascii ?
will i have to set a full table of characters :o?!
thanks

Exolent[jNr] 05-31-2010 15:52

Re: javascript unescape ?
 
Notice you are using 00DC, which is a hexadecimal number.
In Pawn, you can use hexadecimal numbers instead of base10 numbers.

I assume you know how strings work:
Code:
new szString[ 4 ]; // max 3 chars with the last array index as ^0 // since strings must have a null terminator szString[ 0 ] = 'c'; szString[ 1 ] = 'a'; szString[ 2 ] = 't'; // characters can also be represented as numbers szString[ 0 ] = 99; szString[ 1 ] = 97; szString[ 2 ] = 116; // now, to use hexadecimal numbers szString[ 0 ] = 0x63; szString[ 1 ] = 0x61; szString[ 2 ] = 0x74;

ÜnLoCo 06-01-2010 23:38

Re: javascript unescape ?
 
:S thank you !!! :mrgreen:
i will try replacing \uXXXX with 0xXXXX and c :D

Seta00 06-02-2010 19:12

Re: javascript unescape ?
 
Quote:

Originally Posted by ÜnLoCo (Post 1197666)
:S thank you !!! :mrgreen:
i will try replacing \uXXXX with 0xXXXX and c :D

Looks like you can use this syntax for strings in Pawn:
Code:
new string[] = {0x00DC, "Loco"};

It compiles, I haven't tested the output.


All times are GMT -4. The time now is 05:19.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.