$asc: Difference between revisions
Jump to navigation
Jump to search
just a little explanation |
mNo edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 9: | Line 9: | ||
//echo -a $asc([[$?]]) | //echo -a $asc([[$?]]) | ||
Type the character you want the ascii value of in the prompt and press enter. This is necessary as you can't use something like 'echo -a $asc(,)', as mIRC would think the comma is seperating parameters and so return '* Too many parameters: $asc'. | Type the character you want the ascii value of in the prompt and press enter. This is necessary as you can't use something like 'echo -a $asc(,)', as mIRC would think the comma is seperating parameters and so return '* Too many parameters: $asc'. | ||
== Little snippet == | |||
You can also use an alias to find out ASCII value of char(s), usage: /ascii ab '''→''' a = 97, b = 98 | |||
alias ascii { | |||
var %x = 1,%y | |||
while (%x <= $len($1-)) { | |||
var %y = %y $mid($1-,%x,1) = $asc($mid($1-,%x,1)) $+ $chr(44) | |||
inc %x | |||
} | |||
echo -a $left(%y,-1) | |||
} | |||
== See Also == | == See Also == | ||
[[$chr]] returns the character of an ascii number. | * [[$chr]] returns the character of an ascii number. | ||
[[Category:Text_and_Number_Identifiers]] | [[Category:Text_and_Number_Identifiers]] |
Latest revision as of 09:01, 2 July 2007
Returns the ascii number of the character C.
$asc(C)
Example
echo -a $asc(A) ; returns 65.
To get the ascii value of a character, just type:
//echo -a $asc($?)
Type the character you want the ascii value of in the prompt and press enter. This is necessary as you can't use something like 'echo -a $asc(,)', as mIRC would think the comma is seperating parameters and so return '* Too many parameters: $asc'.
Little snippet
You can also use an alias to find out ASCII value of char(s), usage: /ascii ab → a = 97, b = 98
alias ascii { var %x = 1,%y while (%x <= $len($1-)) { var %y = %y $mid($1-,%x,1) = $asc($mid($1-,%x,1)) $+ $chr(44) inc %x } echo -a $left(%y,-1) }
See Also
- $chr returns the character of an ascii number.