From WikiChip
Editing mirc/identifiers/$min

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 14: Line 14:
  
 
== Examples ==
 
== Examples ==
 +
* See $sorttok for more details of how text and number tokens are handled. Briefly, non-numerics trailing the tokens in a numeric sort do not affect the sort order. Numeric tokens evaluating to the same number, and text tokens evaluating to the same string returns the leftmost of those tokens. The only difference caused by .textcs vs .text is whether the a-z and A-Z ranges are treated as equivalents.<br />
 +
 +
Tokens can only be space- or comma- delimited. To have any other delimiter you must use $sorttok.<br />
  
 
<source lang="mIRC">//echo -a $min(11 2 3 5 8 13) $min(11,2,3,5,8,13)</source>
 
<source lang="mIRC">//echo -a $min(11 2 3 5 8 13) $min(11,2,3,5,8,13)</source>
  
 +
For a comma to be a delimiter, it must be a literal comma, so a comma contained within a variable or a $chr(44) are not delimiters. These return a comma character as the minimum because its codepoint is lower:
  
 +
<source lang="mIRC">//var %a 1 $chr(44) 2 | echo -a $min(1 $chr(44) 2) vs $min(%a) </source>
 +
 +
Because default is the numerical sort, and all non-numerics evaluate as zero, the leftmost token in this list is returned.<br />
 +
 +
<source lang="mIRC">//echo -a $max(b B a A c C) vs $min(b B a A c C)</source>
  
 
<source lang="mIRC">//echo -a $min(c C).text vs $min(c C).textcs</source>
 
<source lang="mIRC">//echo -a $min(c C).text vs $min(c C).textcs</source>
  
Returns "c vs C" because, as case-insensitive text, 'C' and 'c' are the same, so the leftmost of the pair is returned.
+
Returns "c vs C" because, as case-insensitive text, 'C' and 'c' are the same, so the leftmost of the pair is returned. Sorting is done by codepoint, so accented vowels are sorted by their codepoint location, with no effect on whether their symbol represents a variant of a/e/i/o/u.<br />
  
Numeric sorting rules recognize exponential, so $min(1e2 1d2) handles both of them as 100.
+
Numeric sorting rules recognize exponential, so $min(1e2 99) handles both 1e2 and 1d2 the same as 100.<br />
 +
 
 +
Trailing non-numerics do not affect the result of numeric sorts<br />
  
 
<source lang="mIRC">//echo -a $min( 1:black 02:blue 14:grey 3:green 13:magenta 5:maroon 6:purple 04:red 7:tan 8:yellow 0:white)</source>
 
<source lang="mIRC">//echo -a $min( 1:black 02:blue 14:grey 3:green 13:magenta 5:maroon 6:purple 04:red 7:tan 8:yellow 0:white)</source>
Line 31: Line 42:
  
 
<source lang="mIRC">//echo -a $asc(@) $asc(%) $asc(+) $min(@nick % $+ nick +nick).nick vs $min(@nick % $+ nick +nick).text</source>
 
<source lang="mIRC">//echo -a $asc(@) $asc(%) $asc(+) $min(@nick % $+ nick +nick).nick vs $min(@nick % $+ nick +nick).text</source>
 
 
== Compatibility ==
 
== Compatibility ==
 
{{mIRC compatibility|7.62}}
 
{{mIRC compatibility|7.62}}

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)