Template:String-handling templates: Difference between revisions
Jump to navigation
Jump to search
Being deleted |
imported>DePiep m wikitext-handling templates |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 12: | Line 12: | ||
| {{Aligned table |style=padding-right:2em; | | {{Aligned table |style=padding-right:2em; | ||
|col1style=width:12em;text-align:right;padding-right:0.75em; | |col1style=width:12em;text-align:right;padding-right:0.75em; | ||
| | | {{tl|str sub new}} | Select a substring based on starting and ending index counted in either direction. | ||
| {{tl|str left}} | Keep the first N characters of a string, or duplicate it to N characters. | | {{tl|str left}} | Keep the first N characters of a string, or duplicate it to N characters. | ||
| {{tl|str crop}} | Return all but the last N characters of a string. | | {{tl|str crop}} | Return all but the last N characters of a string. | ||
Line 53: | Line 53: | ||
|col1style=width:12em;text-align:right;padding-right:0.75em; | |col1style=width:12em;text-align:right;padding-right:0.75em; | ||
| {{tl|delink}}, {{tl|trim brackets}} | Removes wikilink brackets (wikicode); ''all'' or ''outer only''. | | {{tl|delink}}, {{tl|trim brackets}} | Removes wikilink brackets (wikicode); ''all'' or ''outer only''. | ||
| {{tl| | | {{tl|Plain text}} | Removes wikicode (formatting and brackets) | ||
| {{tl|PAGENAMEBASE}} | Trim off any parenthesis text at the end of a string (disambiguation). | | {{tl|PAGENAMEBASE}} | Trim off any parenthesis text at the end of a string (disambiguation). | ||
| {{tl|title disambig text}} | Returns text in parentheses at the end of a string (disambiguation). | | {{tl|title disambig text}} | Returns text in parentheses at the end of a string (disambiguation). | ||
Line 78: | Line 78: | ||
| {{tl|str rep}} | Returns the string, after replacing the first occurrence of a specified string with another string. | | {{tl|str rep}} | Returns the string, after replacing the first occurrence of a specified string with another string. | ||
| {{tl|digits}} | Returns the string, after removing all characters that are not digits 0–9 | | {{tl|digits}} | Returns the string, after removing all characters that are not digits 0–9 | ||
| | | {{tl|Nowiki}} | Displays wikitext as plain text. | ||
}} | }} | ||
| <!---(Length)---> | | <!---(Length)---> | ||
Line 97: | Line 97: | ||
{{Aligned table |style=padding-right:2em; | {{Aligned table |style=padding-right:2em; | ||
|col1style=text-align:right;padding-right:0.75em; | |col1style=text-align:right;padding-right:0.75em; | ||
| {{ | | {{tl|str startswith}}<br>{{tl|str endswith}} | Check if a string starts or ends with a given string. | ||
| {{tl|str find}}, {{tl|strfind short}} |style2.2=vertical-align:middle;| Returns the numerical location of a given string in a string. | | {{tl|str find}}, {{tl|strfind short}} |style2.2=vertical-align:middle;| Returns the numerical location of a given string in a string. | ||
| {{tl|in string}} | Returns optional string when given string is not found | | {{tl|in string}} | Returns optional string when given string is not found | ||
Line 106: | Line 106: | ||
|col1style=text-align:right;padding-right:0.75em; | |col1style=text-align:right;padding-right:0.75em; | ||
| {{tl|a or an}} | Takes a noun and produces the appropriate indefinite article, based on whether the first letter is a vowel. | | {{tl|a or an}} | Takes a noun and produces the appropriate indefinite article, based on whether the first letter is a vowel. | ||
| {{tl|Array}} | Array manipulation and retrieval. | |||
| {{tl|Font style}} | Returns bold or italic if the input value has either formatting. | |||
| {{tl|Isnumeric}} | Returns number when true, blank when not numeric. | | {{tl|Isnumeric}} | Returns number when true, blank when not numeric. | ||
| {{tl|str letter}} | Returns the number of letters that begin a string. | | {{tl|str letter}} | Returns the number of letters that begin a string. | ||
Line 118: | Line 120: | ||
|group6=Modules and built-in functions | |group6=Modules and built-in functions | ||
|list6={{div col|style=text-align:left}} | |list6={{div col|style=text-align:left}} | ||
* [[:Module:String]], [[:Module:String2]], [[:Module:Ustring]], [[Module:Text]]: modules that together contain most necessary string functions. | * [[:Module:String]], [[:Module:String2]], [[:Module:Ustring]], [[Module:Text]], [[:Template:Navbox wikitext-handling templates|wikitext handling]]: modules that together contain most necessary string functions. | ||
* [[mw:Help:Magic words|Magic words]]: About <code><nowiki>{{padleft:|}}</nowiki></code>, <code><nowiki>{{lc:|}}</nowiki></code>, <code><nowiki>{{formatnum:|}}</nowiki></code> etc. | * [[mw:Help:Magic words|Magic words]]: About <code><nowiki>{{padleft:|}}</nowiki></code>, <code><nowiki>{{lc:|}}</nowiki></code>, <code><nowiki>{{formatnum:|}}</nowiki></code> etc. | ||
* [[mw:Help:Extension:ParserFunctions|ParserFunctions]]: About <code><nowiki>{{#titleparts:|}}, {{#expr:|}}, {{#ifeq:|}}, </nowiki></code> etc.{{div col end}} | * [[mw:Help:Extension:ParserFunctions|ParserFunctions]]: About <code><nowiki>{{#titleparts:|}}, {{#expr:|}}, {{#ifeq:|}}, </nowiki></code> etc.{{div col end}} | ||
Line 129: | Line 131: | ||
** [[:m:Category:String manipulation templates|Meta-Wiki]] | ** [[:m:Category:String manipulation templates|Meta-Wiki]] | ||
** [[:d:Category:String manipulation templates|Wikidata]] | ** [[:d:Category:String manipulation templates|Wikidata]] | ||
* [[:Category:Modules that manipulate strings|Category:String manipulating modules]] | |||
| tracking = no <!--(keep all these string templates (by /doc pages) out of the tracking category)--> | | tracking = no <!--(keep all these string templates (by /doc pages) out of the tracking category)--> | ||
}}<noinclude>{{documentation}}</noinclude> | }}<noinclude>{{documentation}}</noinclude> |
Latest revision as of 16:19, 26 February 2023
Add {{String-handling templates}} to the bottom of a documentation page of a template listed in the navbox.
How to manage this template's collapsible groups/sections option
- This template includes collapsible groups/sections. When it first appears, one of these groups/sections may be set to be visible ("expanded") while the others remain hidden ("collapsed") apart from their titlebars. To achieve this, include the parameter
|name
where name is one of the following words that identify the groups/sections (omit any speech or quotation marks): - trim
- IRL
- anlys/tech
Initial visibility: currently defaults to expanded
To set this template's initial visibility, the |state=
parameter may be used:
|state=collapsed
:{{String-handling templates|state=collapsed}}
to show the template collapsed, i.e., hidden apart from its title bar|state=expanded
:{{String-handling templates|state=expanded}}
to show the template expanded, i.e., fully visible|state=autocollapse
:{{String-handling templates|state=autocollapse}}
If the |state=
parameter in the template on this page is not set, the template's initial visibility is taken from the |default=
parameter in the Collapsible option template. For the template on this page, that currently evaluates to expanded
.