Template:Str len
- English
- español
- 日本語
- Deutsch
- français
- 中文
- русский
- italiano
- português
- Nederlands
- العربية
- аԥсшәа
- Acèh
- Afrikaans
- алтай тил
- অসমীয়া
- asturianu
- авар
- azərbaycanca
- تۆرکجه
- башҡортса
- Basa Bali
- Boarisch
- беларуская
- български
- भोजपुरी
- বাংলা
- bosanski
- català
- 閩東語 / Mìng-dĕ̤ng-ngṳ̄
- нохчийн
- Cebuano
- کوردی
- čeština
- чӑвашла
- dansk
- Zazaki
- dolnoserbski
- eʋegbe
- Ελληνικά
- Esperanto
- eesti
- euskara
- فارسی
- mfantse
- føroyskt
- Gaeilge
- Gagauz
- Gàidhlig
- galego
- گیلکی
- ગુજરાતી
- wayuunaiki
- Gaelg
- Hausa
- 客家語 / Hak-kâ-ngî
- עברית
- हिन्दी
- Fiji Hindi
- hrvatski
- hornjoserbsce
- magyar
- հայերեն
- Արեւմտահայերէն
- Bahasa Indonesia
- Ilokano
- íslenska
- Jawa
- ქართული
- Taqbaylit
- Kumoring
- қазақша
- ភាសាខ្មែរ
- ಕನ್ನಡ
- 한국어
- kurdî
- кыргызча
- Latina
- Lëtzebuergesch
- лакку
- Ligure
- Ladin
- latviešu
- मैथिली
- мокшень
- олык марий
- Māori
- Minangkabau
- македонски
- മലയാളം
- монгол
- ဘာသာမန်
- मराठी
- кырык мары
- Bahasa Melayu
- မြန်မာဘာသာ
- эрзянь
- مازِرونی
- Plattdüütsch
- नेपाली
- नेपाल भाषा
- occitan
- livvinkarjala
- ଓଡ଼ିଆ
- ирон
- ਪੰਜਾਬੀ
- Pälzisch
- rumantsch
- română
- tarandíne
- русиньскый
- संस्कृतम्
- саха тыла
- sicilianu
- Scots
- တႆး
- සිංහල
- Simple English
- slovenčina
- slovenščina
- shqip
- српски / srpski
- svenska
- Kiswahili
- Sakizaya
- தமிழ்
- తెలుగు
- тоҷикӣ
- ไทย
- tolışi
- Türkçe
- татарча / tatarça
- українська
- اردو
- oʻzbekcha / ўзбекча
- Tiếng Việt
- Volapük
- 吴语
0
Category:Semi-protected templates#Str%20len![]() | Uses Lua: |
This is the {{Str len }} meta-template.
It takes a string as parameter and returns its length (excluding spaces at the start and end). It can now count as high as necessary.
Examples
If the parameter is empty or undefined it is considered to be of zero length:
{{str len}}
returns 0{{str len|}}
returns 0{{str len| }}
returns 0
It counts the length correctly, even if the string contains spaces, looks like a number, or contains special characters:
{{str len| ab cde }}
returns 6
{{str len| 1234567 }}
returns 7
{{str len| café åäö }}
returns 8
{{str len| 499-characters... }}
returns 499{{str len| 1000-characters... }}
returns 1000
Template data
This is the TemplateData documentation for this template used by VisualEditor and other tools.
Str len
The template takes a string as parameter and returns its length, excluding spaces at the start and end of the string
Parameter | Description | Type | Status | |
---|---|---|---|---|
Alpha-numeric text | 1 | The string to be counted | String | required |
Technical details
This is the first general-purpose template to be implemented using mw:Extension:Scribunto. The Lua code is located in Module:String.
See also
Template:Navbox string handling templates
Category:String manipulation templates#Str%20len
Editors can experiment in this template’s sandbox (create | mirror) and testcases (create) pages.
Please add categories to the /doc subpage. Subpages of this template.