From WikiChip
Editing mirc/identifiers/$asc

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

This page supports semantic in-text annotations (e.g. "[[Is specified as::World Heritage Site]]") to build structured and queryable content provided by Semantic MediaWiki. For a comprehensive description on how to use annotations or the #ask parser function, please have a look at the getting started, in-text annotation, or inline queries help pages.

Latest revision Your text
Line 1: Line 1:
{{mirc title|$asc Identifier}}'''$asc''' returns the [[Unicode]] [[code point]] number for the character (or first character of the string).
+
{{mirc title|$asc Identifier}}'''$asc''' is used to return the [[Unicode]] [[code point]] number for a specified character.
 +
 
  
 
== Synopsis ==
 
== Synopsis ==
<pre>$asc(<char|string>)</pre>
+
<pre>$asc(<char>)</pre>
 +
 
 
== Switches ==
 
== Switches ==
 
None
 
None
 +
 
== Parameters ==
 
== Parameters ==
<span style="display: inline-block; width: 50px;">'''char'''</span>This would be any special character, letter, or number for which you wish to retrieve the [[Unicode]] [[code point]]. Only codepoints 1-65535 are valid. For codepoints above 65535, it instead returns the first UTF-8 surrogate. If the parameter is a string, the 1st character of the string is used as the 'char'. If parameter is a string, it uses only the 1st character of that string.
+
<span style="display: inline-block; width: 50px;">'''char'''</span>This would be any special character, letter, or number that you wish to retrieve the [[Unicode]] [[code point]] for.
  
* Note: mIRC v6.35 and earlier only support codepoints 1-255
+
== Example ==
== Examples ==
+
'''Echo the [[Unicode]] [[code point]] for the letter ''A'' to the active window'''
'''Echo the [[Unicode]] [[code point]] for the letters ''A'' and ''a'' to the active window'''
+
<pre>//echo -a $asc(A)</pre>
<pre>//echo -a A is $asc(A) and a is $asc(a)</pre>
 
  
 
'''Echo the [[Unicode]] [[code point]] for the number ''7'' to the active window'''
 
'''Echo the [[Unicode]] [[code point]] for the number ''7'' to the active window'''
 
<pre>//echo -a $asc(7)</pre>
 
<pre>//echo -a $asc(7)</pre>
  
<source lang="mIRC">
 
Echo the Unicode codepoint for the lower-case 'm' because that's the first character of the string.
 
//echo -a $asc(mIRC)
 
 
Retrieve the codepoint for any input:
 
alias Get_Asc {
 
  //var %a $input(type or paste any character/string or alt-NNN or alt-0NNN value,e) | echo -a the codepoint for %a  is $asc(%a)
 
}
 
 
The C parameter for the token identifiers uses the same codepoint number output by $asc():
 
//echo -a mIRC.exe is located in folder $gettok($mircexe,-2,$asc(\))
 
</source>
 
<source lang="mIRC">
 
Unicode codepoint 128286 has UTF-8 Encoding of 0xF0 0x9F 0x94 0x9F and UTF-16 Encoding of 0xD83D 0xDD1F. Translated to decimal, these numbers are UTF-8 240 159 148 159 and UTF-16 55357 56607. If you change the font to "Segoe UI Symbol" which supports viewing this emoji, you'll see a number 10 inside a box. The numbers in the displayed message are the same even if your Font doesn't correctly display the emoji. This shows that $asc sees the only the UTF-8 surrogates of the string.
 
 
//bset &v 1 240 159 148 159 | var %a $bvar(&v,1-).text | echo -a  %a is $asc($mid(%a,1)) $asc($mid(%a,2))
 
</source>
 
 
== Compatibility ==
 
== Compatibility ==
 
{{mIRC compatibility|4.5}}
 
{{mIRC compatibility|4.5}}
 +
 
== See also ==
 
== See also ==
 
* {{mIRC|$chr}}
 
* {{mIRC|$chr}}
* {{mIRC|$gettok}}
+
* [[List of identifiers - mIRC]]
 +
{{mIRC identifier list}}
 +
 
 +
[[Category:mIRC identifiers|asc]]

Please note that all contributions to WikiChip may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see WikiChip:Copyrights for details). Do not submit copyrighted work without permission!

Cancel | Editing help (opens in new window)