Template:String-handling templates: Difference between revisions
From Zoophilia Wiki
Jump to navigationJump to search
meta>DePiep /doc |
meta>DePiep turn into navbox |
||
Line 1: | Line 1: | ||
{{navbox | |||
| title= String handling templates | |||
| name=String templates see also text/sandbox | |||
* {{tl|Str mid}} | | state={{{state}|}}} | ||
| above=''As of February 2013, these templates are being optimised using [[WP:Lua|Lua]] modules. More [[Template:String templates see also text|here]].'' | |||
| group1 = [[Trim (programming)|Trim]] by counting | |||
| list1= | |||
* {{tl|Str mid}} – To return a substring, specified by its position and length. | |||
* {{tl|Trunc}} – To trim down to a specified number of characters. | * {{tl|Trunc}} – To trim down to a specified number of characters. | ||
* {{tl|Str left}} – To trim down to a specified number of characters, or duplicate the string to a specified number. | * {{tl|Str left}} – To trim down to a specified number of characters, or duplicate the string to a specified number. | ||
* {{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}} | * {{tl|Chop head and tail}} – To crop a specified number of characters off the beginning and end. | ||
* {{tl|Str right}} | * {{tl|Str right}} – To trim the first specified number of characters. | ||
* {{tl|Str rightc}} | * {{tl|Str rightc}} – To return a number of characters from the end, returns a parameter if the string is empty. | ||
* {{tl|Str rightmost}} | * {{tl|Str rightmost}} – To trim down to the last specified number of characters. | ||
* {{tl|Str sub old}} | * {{tl|Str sub old}} – To trim down to a specified number, starting at a given number from the left. | ||
* {{tl|Str sub new}} | * {{tl|Str sub new}} – Select a substr based on starting and ending index. | ||
* {{tl|Str index}} – Returns a given character from a string, but not accented letters. | |||
= | | group2=Trim by checking | ||
* {{tl|Trim}} | | list2= | ||
* {{tl|First word}} | * {{tl|Trim}} – To trim any leading or trailing whitespace ({{tl|Strip whitespace}} does so too, but is less effective) | ||
* {{tl|Remove first word}} | * {{tl|First word}} – To trim down to the first space. | ||
* {{tl|Str letter/trim}} | * {{tl|Remove first word}} – To remove anything before the first space. | ||
* {{tl|Str number/trim}} | * {{tl|Str letter/trim}} – To trim down to the beginning letters. | ||
* {{tl|Str number/trim}} – To trim down to the beginning numbers. | |||
= | | group3= Insert strings | ||
|list3= | |||
* {{tl|Repeat}} – Repeat character string n times | |||
* {{tl|Replace}} – Returns the string, after replacing ''all'' occurrences of a specified string with another string. | |||
* {{tl|Strloc insert}} – Inserts a string at character location strloc, or appends if strloc<=0. | |||
* {{tl|Strloc prefix}} – Extracts string prefix up to location strloc, or whole string if strloc<=0. | |||
* {{tl|Str rep|Str rep}} – Returns the string, after replacing the first occurrence of a specified string with another string. | |||
* {{ | |group4= Length | ||
* {{ | |list4= | ||
* {{ | * {{tl|Str len}} – Returns a string's length. | ||
* {{tl| | * {{tl|iflenge}} – IF LENgth Greater then or Equal to. | ||
* {{ | * {{tl|Str ≥ len}} – To check if a string is "longer or equally long" or "shorter" than a given length. | ||
* {{tl|Str ≤ len}} – To check if a string is "shorter or equally long" or "longer" than a given length. | |||
* {{tl|Str ≠ len}} – To check if a string is "not equal" or "equal" to a given length. | |||
* {{tl|Str ≤ ≥ len}} – To check if a string is "shorter", "equal", or "longer" than a given length. | |||
| group5=Analyse string | |||
| list5= | |||
* {{tl|Str endswith}} – To check if a string ends with a given string. | * {{tl|Str endswith}} – To check if a string ends with a given string. | ||
* {{tl|Str find}} – Returns the numerical location of a given string in a string. | * {{tl|Str find}} – Returns the numerical location of a given string in a string. | ||
* {{tl|Strfind short}} – Returns the numerical location of a given string in a string. | * {{tl|Strfind short}} – Returns the numerical location of a given string in a string. | ||
* {{tl|Str find0}} – Zero-based substring search. | * {{tl|Str find0}} – Zero-based substring search. | ||
* {{tl|Str sub find}} – Searches a substring in a string at the given offset. | * {{tl|Str sub find}} – Searches a substring in a string at the given offset. | ||
* {{tl| | * {{tl|ASCII code}} – Returns the ASCII value of a single character. | ||
* {{tl|Str | * {{tl|Str letter}} – Returns the number of letters that begin a string. | ||
* {{tl|Str number}} – Returns the number of numbers that begin a string. | |||
* {{tl|Str number}} | * {{tl|Str gtr str}} – Compares two strings for alphabetical order, and returns a value accordingly. | ||
* {{tl| | |||
== | | group6=Trim, dedicated | ||
| list6= | |||
* {{tl|WikiProjectbasename}} - Removes "WikiProject" from a pagename | |||
* {{tl|Remove unranked}} - Removes the string "unranked_" from the left of a string (taxonomy). | |||
* {{tl|Ship prefix}} – Returns the length of a ship name prefix, if listed (ship names). | |||
* {{tl|Title without disambig}} – 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|Unlink}} – Removes wikilink brackets (wikicode). | |||
* {{ | |group11=Technical developments | ||
* {{ | |list11= | ||
* [[Module:String]] | |||
* [[mw:Help:Magic words]] – About <code><nowiki>{{padleft:|}}</nowiki></code>. | |||
* [[mw:Help:Extension:ParserFunctions]] – About <code><nowiki>{{#titleparts:|}}, {{#expr:|}}, {{#ifeq:|}}, </nowiki></code> etc. | |||
|group12=Feature requests | |||
|list12 | |||
* [[bugzilla:6455]] – Set $wgPFEnableStringFunctions = true on WMF wikis | |||
* [[bugzilla:26092]] – Enable or install string parsing wikimarkup functionality on WMF wikis | |||
= | <!-- not in a navbox | ||
[[Wikipedia:Template sandbox and test cases|Sandboxes and test cases]]: | |group13=[[Wikipedia:Template sandbox and test cases|Sandboxes and test cases]]: | ||
|list13= | |||
* {{tl|Str find/sandbox}} | * {{tl|Str find/sandbox}} | ||
Line 67: | Line 94: | ||
* {{tl|Str ≠ len/sandbox}} | * {{tl|Str ≠ len/sandbox}} | ||
* {{tl|Str ≠ len/testcases}} | * {{tl|Str ≠ len/testcases}} | ||
--> | |||
| below= | |||
* [[:Category:String manipulation templates]] | |||
* [[m:Category:String templates]] | |||
* [[:commons:Category:String manipulation templates]] | |||
| belowclass=hlist | |||
}}<noinclude> | |||
{{documentation}} | {{documentation}} | ||
</noinclude> | </noinclude> |