Jump to content

Template:Chr/doc

From Meta, a Wikimedia project coordination wiki

Usage

[edit]

{{chr|text|n}} = Returns the n-th character of text ( 1 ≤ n ≤ 499 ), and nothing if n is outside this range, or if n is greater than the length of the string.

Supports a fairly large character set, all 99 characters from Template:Chrfn and more. Returns "˚" on unknown characters. To avoid an automatic newline, the characters *#:; are returned inside <nowiki> tags.

Examples

[edit]
  • "{{chr|abc|1}}" gives "a" [1]
  • "{{chr|abc|2}}" gives "b" [2]
  • "{{chr|abc|3}}" gives "c" [3]
  • "{{chr| bc|1}}" gives " " [4]
  • "{{chr| bc|2}}" gives "b" [5]
  • "{{chr| bc|3}}" gives "c" [6]
  • "{{chr|a c|1}}" gives "a" [7]
  • "{{chr|a c|2}}" gives " " [8]
  • "{{chr|a c|3}}" gives "c" [9]
  • "{{chr|ab |1}}" gives "a" [10]
  • "{{chr|ab |2}}" gives "b" [11]
  • "{{chr|ab |3}}" gives " " [12]
  • "{{chr|a  |1}}" gives "a" [13]
  • "{{chr|a  |2}}" gives " " [14]
  • "{{chr|a  |3}}" gives " " [15]
  • "{{chr| b |1}}" gives " " [16]
  • "{{chr| b |2}}" gives "b" [17]
  • "{{chr| b |3}}" gives " " [18]
  • "{{chr|  c|1}}" gives " " [19]
  • "{{chr|  c|2}}" gives " " [20]
  • "{{chr|  c|3}}" gives "c" [21]
  • "{{chr|   |1}}" gives " " [22]
  • "{{chr|   |2}}" gives " " [23]
  • "{{chr|   |3}}" gives " " [24]
  • "{{chr|abc|4}}" gives "" [25]
  • "{{chr|メインページ|2}}" gives "˚" [26]

"{{chr|a
c|2}}"
gives " " [27]

"{{chr|ac|2}}" gives " " [28]

"{{chr|a

d|2}}{{chr|a

d|3}}"

gives:

"

"

  • "{{chr|123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123|499}}" gives "9" [29]
  • "{{chr|123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123|500}}" gives "" [30]
  • "{{chr|123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123|499}}" gives " " [31]

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 higher the index n, the more it is.

Examples:

{{chr|a23456789a12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789a|10}} gives a template argument size of 821 bytes.

{{chr|a23456789ŋ12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789a|10}} gives a template argument size of 7475 bytes.

{{chr|a23456789a12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789a|100}} gives a template argument size of 1742 bytes.

{{chr|a23456789ŋ12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789a|100}} gives a template argument size of 68820 bytes.

See also

[edit]