Template:String-handling templates: Difference between revisions

Safer nicotine wiki Tobacco Harm Reduction
Jump to navigation Jump to search
m 1 revision imported
Template:Str_left: Redundant, out of the std with the rest
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;
     | '''{{ml|string|sub|section=#sub}}<br> {{tl|str sub new}}''' | Select a substring based on starting and ending index counted in either direction.
     | {{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|remove file prefix}} | Removes "File:" (or "Image:") from filenames.
       | {{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|Plain text}}, {{tl|Nowiki}}   | Strips wikicode from a string.
     | {{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;
     | {{ml|string2|startswith}}<br>{{tl|str endswith}}  | Check if a string starts or ends with a given string.
     | {{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 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>

Revision as of 04:32, 1 June 2022

Lua error: Internal error: The interpreter exited with status 127.Lua error: Internal error: The interpreter exited with status 127.