Template:Str letter/doc
Jump to navigation
Jump to search
File:Edit-copy green.svg | Template:Strong for Template:Terminate sentence It may contain usage information, categories and other content that is not part of the original template page. |
File:Ambox warning orange.svg | This template is used on approximately 174,000 pages. To avoid major disruption and server load, any changes should be tested in the template's /sandbox or /testcases subpages, or in your own user subpage. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
File:Lua-Logo.svg | This template uses Lua: |
This is the {{str letter}} meta-template.
It takes a string as parameter, and returns its length of preceding letters.
Examples
If the parameter is empty or undefined it is considered to be of zero length:
{{str letter}}
returns 0{{str letter|}}
returns 0{{str letter| }}
returns 0
The count is interrupted by numbers, symbols, and punctuation:
{{str letter|12345}}
returns 0{{str letter|12345abc}}
returns 0{{str letter|abcdef?}}
returns 6{{str letter|abc def}}
returns 3{{str letter|ABcD123}}
returns 4{{str letter|abc, def}}
returns 3{{str letter|abc(def)}}
returns 3{{str letter|abc xyzabcdefghijklmnopqrstuvwxyz}}
returns 3{{str letter|ÁbČĐÈęFğ}}
returns 8{{str letter|NR<ref>a reference</ref>}}
returns 2
{{str letter|abcdefghijklmnopqrstuvwx}}
returns 24{{str letter|abcdefghijklmnopqrstuvwxyz}}
returns 26
See also
References
- ↑ a reference