Template:Str number/trim
Appearance
| Template documentation follows |
|---|
| Note: the template above may sometimes be partially or fully invisible. |
| Visit "Template:Str number/trim/doc" to edit its documentation if it is available. (How does this work?) |
| This template is used on approximately 227,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. |
| This template can only be edited by administrators because it is transcluded onto one or more cascade-protected pages. |
| This template uses Lua: |
The Template:Str_number/trim extracts a number at the start of parameter 1.
It takes a string as parameter, and returns the string trimmed to the beginning number if non-numeric text does not appear before the first number.
Examples
{{Str number/trim}}→{{Str number/trim|abcde}}→{{Str number/trim|abcde123}}→{{Str number/trim|123456}}→ 123456{{Str number/trim|123 456}}→ 123{{Str number/trim|123.456}}→ 123{{Str number/trim|1976–2006}}→ 1976{{Str number/trim|19/76+2006}}→ 19{{Str number/trim|19 (302)}}→ 19{{Str number/trim|1234abc}}→ 1234{{Str number/trim|1234abc56}}→ 1234{{Str number/trim|12345678901234567890}}→ 12345678901234567890{{Str number/trim|1234567890123456789012345}}→ 1234567890123456789012345{{Str number/trim| 1234567890123456789012345}}→ 1234567890123456789012345{{Str number/trim|13<ref>a reference</ref>}}→ 13{{Str number/trim|24.51 km (15.23 mi)}}→ 24
References
- ↑ a reference
See also
- {{cardinal}}, remove ordinal indicators, eg.
{{cardinal|1st}}→ 1 - {{digits}}, remove all characters from a string that are not digits
Lua error in Module:Navbox_with_collapsible_groups at line 6: attempt to call field 'with collapsible groups' (a nil value).