From WikiChip
Editing mirc/identifiers/$upper

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|$upper Identifier}}'''$upper''' returns text in upper case
 
{{mirc title|$upper Identifier}}'''$upper''' returns text in upper case
 +
 +
 
== Synopsis ==
 
== Synopsis ==
 
<pre>$upper(text)</pre>
 
<pre>$upper(text)</pre>
== Parameters ==
+
 
 +
== Paramters ==
 +
 
 
* '''text''' - the text you want in uppercase
 
* '''text''' - the text you want in uppercase
 +
 
== Properties ==
 
== Properties ==
 
None
 
None
 +
 
== Example ==
 
== Example ==
 
<source lang="mIRC">//echo -a $upper(ab)</source>
 
<source lang="mIRC">//echo -a $upper(ab)</source>
  
Note: A-Z and a-z are the only ranges of characters which the == and != operators consider to be case-insensitive equivalents of each other. However $upper $lower $isupper and $islower and the operators isupper and islower also consider 1894 codepoints in the range 192-65535 to have an uppercase or lowercase versions of themselves. This next command displays 1946 lines showing all codepoints affected by either $upper or $lower:
 
 
<source lang="mIRC">
 
//var %i 1 , %c 0 | while (%i isnum 1-65535) { var -p %a $chr(%i) , %v1 %a %a , %v2 $upper(%a) $lower(%a) | if (%v1 !=== %v2) { inc %c | echo -a $ord(%c) codepoint %i is $chr(%i) upper is codepoint $asc($upper(%a)) $upper(%a) lower is codepoint $asc($lower(%a)) $lower(%a) } | inc %i }
 
</source>
 
 
If you edit the above command by changing !=== to != you can see the display shows 1894 rows instead of 1946. The difference is caused by the case-insensitive != operator viewing only the A-Z a-z ranges among those affected by $upper or $lower to be case-insensitive equivalents of each other.
 
 
If it's essential that your code changes ONLY the A-Z a-z ranges, use the aliases below. If you edit the above command to use $upper26() and $lower26() in place of $upper() and $lower(), the 1946-line display changes to show only the 52 characters in the A-Z a-z ranges:
 
 
<source lang="mIRC">
 
//echo -a $upper($chr(233)) vs $lower($chr(233))
 
result: É vs é
 
//echo -a $upper26($chr(233)) vs $lower26($chr(233))
 
result: é vs é
 
</source>
 
 
<source lang="mIRC">
 
alias upper26 { returnex $regsubex($1,/([a-z])/g,$chr($calc($asc(\t) -32))) }
 
alias lower26 { returnex $regsubex($1,/([A-Z])/g,$chr($calc($asc(\t) +32))) }
 
</source>
 
 
== Compatibility ==
 
== Compatibility ==
 
{{mIRC compatibility|4.5}}
 
{{mIRC compatibility|4.5}}
 +
 
== See Also ==
 
== See Also ==
{{collist
+
{{mIRC|$lower}}
|count = 4
+
{{mIRC|$isupper}}
|style = width: 100%; display: inherit;
+
 
|
+
[[Category:mIRC identifiers]]
* {{mIRC|$lower}}
 
* {{mIRC|$isupper}}
 
* {{mIRC|$islower}}
 
* {{mIRC|operators}}
 
}}
 

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)