Template:Len

From Meta, a Wikimedia project coordination wiki

0

Template documentation


Usage[edit]

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.

Examples[edit]

  • "{{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 "34"
  • {{len|<nowiki>abc{{tc}}</nowiki>}}" gives "34"

See also[edit]