Jump to content

Template:Chr/list/doc

From Meta, a Wikimedia project coordination wiki

Usage

[edit]
  • "{{chr/list|abcd|abc}}" gives "d" [1]
  • "{{chr/list|abc |abc}}" gives " " [2]
  • "{{chr/list|abc
    |abc}}"
    gives "

" [3]

  • "{{chr/list|aü|a}}" gives "ü" [4]
  • "{{chr/list|a:|a}}" gives ":" [5] (wikitext: "<nowiki>:</nowiki>")
  • {{chr/list|{{padleft:|4|{{CURRENTTIME}}}}|{{padleft:|3|{{CURRENTTIME}}}}}}{{chr/list|{{padleft:|5|{{CURRENTTIME}}}}|{{padleft:|4|{{CURRENTTIME}}}}}} gives "35" (minutes of the current time)

Template argument size

[edit]

A limitation is the maximum template argument size of 2048000 bytes per page.

For calls of this template this depends on the position of the character to be found in the list of supported characters: the later it occurs in the list, the more it is. Also, the longer the string, the more it is.

Examples:

{{chr/list|a23456789a|a23456789}} gives a template argument size of 93 bytes.

{{chr/list|a23456789b|a23456789}} gives a template argument size of 111 bytes (twice the length of the shorter string extra).

{{chr/list|a23456789ŋ|a23456789}} gives a template argument size of 6072 bytes.

{{chr/list|a23456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789a|a23456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789}} gives a template argument size of 993 bytes.

{{chr/list|a23456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789ŋ|a23456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789}} gives a template argument size of 66732 bytes.

Depending on the application this list could be sorted by decreasing frequency of occurrence of the characters. When dealing with strings in a fixed format one could even use different versions for different values of the index.

See also

[edit]