Difference between revisions of "Template:String-handling templates"
Jump to navigation
Jump to search
m (1 revision: Template:First word) |
m (1 revision imported) |
||
(One intermediate revision by the same user not shown) | |||
Line 22: | Line 22: | ||
| {{tl|str crop}} | To crop a specified number of characters off the end. | | {{tl|str crop}} | To crop a specified number of characters off the end. | ||
| {{tl|chop head and tail}} | To crop a specified number of characters off the beginning and end. | | {{tl|chop head and tail}} | To crop a specified number of characters off the beginning and end. | ||
− | |||
}} | }} | ||
| {{Aligned table | | {{Aligned table | ||
Line 40: | Line 39: | ||
|col1style=width:12.5em;text-align:right;white-space:nowrap;padding-right:0.75em; |col2style=font-style:italic; | |col1style=width:12.5em;text-align:right;white-space:nowrap;padding-right:0.75em; |col2style=font-style:italic; | ||
| {{tl|trim}} | To trim any leading or trailing whitespace | | {{tl|trim}} | To trim any leading or trailing whitespace | ||
− | | {{tl| | + | | {{tl|str letter/trim}} | To trim down to the beginning letters. |
− | | {{tl| | + | | {{tl|str number/trim}} | To trim down to the beginning numbers. |
− | | {{tl| | + | | {{tl|trim brackets}} | To trim any leading or trailing square brackets. |
}} | }} | ||
| {{Aligned table | | {{Aligned table | ||
|col1style=width:12.5em;text-align:right;white-space:nowrap;padding-right:0.75em; |col2style=font-style:italic; | |col1style=width:12.5em;text-align:right;white-space:nowrap;padding-right:0.75em; |col2style=font-style:italic; | ||
− | | {{tl| | + | | {{tl|first word}} | To trim down to the first space. |
− | | {{tl| | + | | {{tl|remove first word}} | To remove anything before the first space. |
| {{tl|last word}} | To trim down from the last space. | | {{tl|last word}} | To trim down from the last space. | ||
| {{tl|remove last word}} | To remove anything after the last space. | | {{tl|remove last word}} | To remove anything after the last space. | ||
Line 57: | Line 56: | ||
| {{Aligned table |style=padding-right:2.5em; | | {{Aligned table |style=padding-right:2.5em; | ||
|col1style=width:12.5em;text-align:right;white-space:nowrap;padding-right:0.75em; |col2style=font-style:italic; | |col1style=width:12.5em;text-align:right;white-space:nowrap;padding-right:0.75em; |col2style=font-style:italic; | ||
− | | {{tl| | + | | {{tl|delink}} | Removes wikilink brackets (wikicode). |
| {{tl|remove file prefix}} | Removes "File:" (or "Image:") from filenames. | | {{tl|remove file prefix}} | Removes "File:" (or "Image:") from filenames. | ||
− | | {{tl| | + | | {{tl|PAGENAMEBASE}} | To trim off any parenthesis text at the end of a string (disambiguation). |
| {{tl|title disambig text}} | Returns text in parenthesis at the end of a string (disambiguation). | | {{tl|title disambig text}} | Returns text in parenthesis at the end of a string (disambiguation). | ||
}} | }} | ||
Line 67: | Line 66: | ||
| {{tl|remove unranked}} | Removes the string "unranked_" from the left of a string (taxonomy). | | {{tl|remove unranked}} | Removes the string "unranked_" from the left of a string (taxonomy). | ||
| {{tl|ship prefix}} | Returns the length of a ship's name prefix, if listed (ship names). | | {{tl|ship prefix}} | Returns the length of a ship's name prefix, if listed (ship names). | ||
+ | | {{tl|title year}} | Returns the 4-digit year from a pagename, if any. | ||
}} }} | }} }} | ||
}} | }} |