Template:Len

From Meta, a Wikimedia project coordination wiki
Jump to: navigation, search

0

[edit] [purge] Template documentation

[edit] Usage

Finds min(length,498) for the expanded wikitext of a given wikitext, including possible spaces, even at the start and end. A newline counts as one character.

[edit] Examples

  • "{{len|abc}}" → "3" [1]
  • "{{len|abc }}" → "4" [2]
  • "{{len| abc}}" → "4" [3]
  • "{{len| abc }}" → "5" [4]
  • "{{len|   }}" → "3" [5]
  • "{{len|
    }}"
    → "1" [6]
  • "{{len|ab
    c}}"
    → "4" [7]
  • "{{len|aaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbb ccccccccccccccccccccccccc ddddddddddddddddddddddddd eeeeeeeeeeeeeeeeeeeeeeee}}" → "127" [8]
  • "{{len|in}}" → "2" [9]
  • "{{len|123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123}}" → "498" [10]

To find the length of the trimmed string, add "1=" in front:

  • "{{len|1= abc }}" gives "3"

<nowiki> tags and their content are internally replaced by a code, affecting the length:

  • {{len|<nowiki>{{tc}}</nowiki>}}" gives "43"
  • {{len|<nowiki>abc{{tc}}</nowiki>}}" gives "43"

[edit] See also

The above documentation is transcluded from Template:Len/doc. (edit | history)
Editors can experiment in this template's sandbox (create) and testcases (create) pages.
Please add categories and interwikis to the /doc subpage. Subpages of this template.
Personal tools
Namespaces

Variants
Actions
Navigation
Community
Beyond the Web
Toolbox