[purge]
This is the documentation page. It should be transcluded into the main template page. See Template:Documentation for more informationParameters[]
|1=: First string to compare.|2=: Second string to compare.|ci=: Set this to do case-insensitive comparison.|versions=: Set this to do a sort-of-numeric comparison:- splits on whitespace and compares tokens alphabetically, except when tokens are all digits/periods, in which case it splits the token on the period and compares the numbers numerically.
Output[]
0if the two strings are the same,-1if the first string sorts before the second,1if the first string sorts after the second.
Examples[]
- normal, alphabetic usage
{{StringCompare| abc | aaa }} → 1
{{StringCompare| aaa | aaaa }} → -1
{{StringCompare| 12 | 8 }} → -1
- versions
{{StringCompare| 1.12.2 | 1.12.2 }} → 0
{{StringCompare| 1.12.2 | 1.12.11 }} → 1
{{StringCompare| 1.12.2 | 1.12.11 |versions=1}} → -1
{{StringCompare| 1.12.2 | 1.8 |versions=1}} → 1
See also[]