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|1976?2006}}
→ 1976
{{Str number/trim|19/76+2006}}
→ 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
See also
字符串處理模板
|
---|
|
|
---|
| 根据?量?理
| | {{
str right
}}
| 返回?左向右移除若干?字符后的字符串
| {{
str rightc
}}
| 返回?后向前指定?量的字符串,如果字符串?空?返回一???
| {{
str sub old
}}
| To trim down to a specified number, starting at a given number from the left.
| {{
str sub new
}}
| Select a substr based on starting and ending index.
| {{
str index
}}
| 返回字符串的第×?字符
|
|
|
---|
| 根据?件?理
| |
---|
| ?用于Wiki?法
| | {{
WikiProjectbasename
}}
| Removes "WikiProject" from a pagename.
| {{
remove unranked
}}
| Removes the string "unranked_" from the left of a string (taxonomy).
| {{
ship prefix
}}
| Returns the length of a ship's name prefix, if listed (ship names).
| {{
title year
}}
| Returns the 4-digit year from a pagename, if any.
|
|
|
---|
|
| |
?入、替換、長度
|
---|
|
{{
strloc insert
}}
| Inserts a string at character location strloc, or appends if strloc<=0.
| {{
loop
}}
| 特定次數重複字串。
| {{
replace
}}
| 在字串中???全部替換某字串後返回。
| {{
str rep
}}
| 在字串中???替換首次出現的某字串後返回。
| {{
digits
}}
| 移除字串中不是數字(0~9)的字元。
|
|
|
|
| | | | |
|
References