Jump to content

User:Davidgothberg/Test44

From Wikipedia, the free encyclopedia

String length template names

[edit]

Testing possible template names for the string length comparison templates. Each name within a group below is equivalent, we only need one template for each group. Question is which names can best be understood by editors and work well technically.

Group A: {{str < len}}1 - {{str ( len}} - {{str ≥ len}}2 - {{str >= len}}1 - {{str lt len}}

Group B: {{str > len}}1 - {{str ) len}} - {{str ≤ len}}2 - {{str <= len}}1 - {{str gt len}}

Group C: {{str == len}}3 - {{str ≈ len}} - {{str ≠ len}}2 - {{str != len}}3 - {{str eq len}}

Group D: {{str >=< len}}1 - {{str ≥ ≤ len}}2 - {{str ≤ ≥ len}}2 - {{str <=> len}}1

1 = Can't be used as template names since MediaWiki doesn't accept those characters in page names.

2 = Can't be typed on keyboards, so the users will have to copy and paste those template names. But works perfectly in MediaWiki, so perhaps are the best choices.

3 = Has some problems with the template name since contains "=" which makes it tricky to add as a parameter to other templates such as {{tl}}.

Examples

[edit]

Checking if the string "abcde" is 4 characters or more:

{{str ≥ len | abcde | 4
| Equal or longer.
| Shorter.
}}

It would return this data:

Equal or longer.


I am also planning to make a template named {{if str len}} or perhaps {{str len compare}}, that could be used like this:

{{#switch: {{if str len| abcde | 4 }}
| shorter = Shorter data.
| equal
| longer = Equal or longer data.
}}

It would return this data:

Equal or longer data.