21 Aug, 2019
By, Wikipedia
Template:Digits
{{digits|string}}
{{digits|1=string}}
Removes all characters from string that are not a digit 0–9.
Examples
{{digits|12px}}
→ 12
{{digits|1,234,567}}
→ 1234567
{{digits|$1.23}}
→ 123
{{digits|1=1+2=3}}
→ 123
See also
- {{str number/trim}}, remove the first non-digit character and everything following
- {{cardinal}}, remove ordinal indicators, eg.
{{cardinal|1st}}
→ 1
String-handling templates (help page) | |||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||
The above documentation is transcluded from Template:Digits/doc. (edit | history)
Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages.
Add categories to the /doc subpage. Subpages of this template.
Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages.
Add categories to the /doc subpage. Subpages of this template.