Template:String-handling templates: Difference between revisions

From Zoophilia Wiki
Jump to navigationJump to search
meta>Janezdrilc
m typo
Ookami (talk | contribs)
m 104 revisions imported
 
(6 intermediate revisions by 2 users not shown)
Line 16: Line 16:
   {{Aligned table |fullwidth=on |style=text-align:left; |col1width=50%;
   {{Aligned table |fullwidth=on |style=text-align:left; |col1width=50%;
     | {{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;
       | {{tl|str mid}}      | To return a substring specified by position and length.
       | {{tl|str mid}}      | To return a substring specified by 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.
Line 24: Line 24:
       }}
       }}
     | {{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;
       | {{tl|str right}}    | To trim the first specified number of characters.
       | {{tl|str right}}    | To trim the first specified number of characters.
       | {{tl|str rightc}}    | To return a number of characters from the end, returns a parameter if the string is empty.
       | {{tl|str rightc}}    | To return a number of characters from the end, returns a parameter if the string is empty.
Line 31: Line 31:
       | {{tl|str sub new}}  | Select a substr based on starting and ending index.
       | {{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.
       | {{tl|str index}}    | Returns a given character from a string, but not accented letters.
      | {{tl|Plain text}}, {{tl|Nowiki}}    | Strips wikicode from a string.
   }} }}
   }} }}


Line 37: Line 38:
   {{Aligned table |fullwidth=on |style=text-align:left; |col1width=50%;
   {{Aligned table |fullwidth=on |style=text-align:left; |col1width=50%;
     | {{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;
       | {{tl|trim}}                | To trim any leading or trailing whitespace
       | {{tl|trim}}                | To trim any leading or trailing whitespace
       | {{tl|str letter/trim}}    | To trim down to the beginning letters.
       | {{tl|str letter/trim}}    | To trim down to the beginning letters.
Line 45: Line 46:
       }}
       }}
     | {{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;
       | {{tl|first word}}          | To trim down to the first space.
       | {{tl|first word}}          | To trim down to the first space.
       | {{tl|remove first word}}  | To remove anything before the first space.
       | {{tl|remove first word}}  | To remove anything before the first space.
Line 56: Line 57:
   {{Aligned table |fullwidth=on |style=text-align:left; |col1width=50%;
   {{Aligned table |fullwidth=on |style=text-align:left; |col1width=50%;
     | {{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;
       | {{tl|delink}}              | Removes wikilink brackets (wikicode).
       | {{tl|delink}}, {{tl|trim brackets}}              | Removes wikilink brackets (wikicode); ''all'' or ''outer only''.
       | {{tl|remove file prefix}}  | Removes "File:" (or "Image:") from filenames.
       | {{tl|remove file prefix}}  | Removes "File:" (or "Image:") from filenames.
       | {{tl|PAGENAMEBASE}}        | To trim off any parenthesis text at the end of a string (disambiguation).
       | {{tl|PAGENAMEBASE}}        | To trim off any parenthesis text at the end of a string (disambiguation).
Line 63: Line 64:
       }}
       }}
     | {{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;
       | {{tl|WikiProjectbasename}} | Removes "WikiProject" from a pagename.
       | {{tl|WikiProjectbasename}} | Removes "WikiProject" from a pagename.
       | {{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).
Line 79: Line 80:
   |  <!---(Insertion, replacement)--->
   |  <!---(Insertion, replacement)--->
     {{Aligned table |style=padding-right:2.5em;
     {{Aligned table |style=padding-right:2.5em;
     |col1style=text-align:right;white-space:nowrap;padding-right:0.75em; |col2style=font-style:italic;
     |col1style=text-align:right;white-space:nowrap;padding-right:0.75em;
     | {{tl|strloc insert}} | Inserts a string at character location strloc, or appends if strloc<{{=}}0.
     | {{tl|strloc insert}} | Inserts a string at character location strloc, or appends if strloc<{{=}}0.
     | {{tl|loop}}          | Repeat character string a specified number of times.
     | {{tl|loop}}          | Repeat character string a specified number of times.
Line 88: Line 89:
   |  <!---(Length)--->
   |  <!---(Length)--->
     {{Aligned table
     {{Aligned table
     |col1style=text-align:right;white-space:nowrap;padding-right:0.75em; |col2style=font-style:italic;
     |col1style=text-align:right;white-space:nowrap;padding-right:0.75em;
     | {{tl|str len}}      | Returns a string's length.
     | {{tl|str len}}      | Returns a string's length.
     | {{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 "longer or equally long" or "shorter" than a given length.
Line 103: Line 104:
   |  <!---(Analysis)--->
   |  <!---(Analysis)--->
     {{Aligned table |style=padding-right:2.5em;
     {{Aligned table |style=padding-right:2.5em;
     |col1style=text-align:right;white-space:nowrap;padding-right:0.75em; |col2style=font-style:italic;
     |col1style=text-align:right;white-space:nowrap;padding-right:0.75em;
     | {{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}}<br/>{{tl|strfind short}} |style2.2=vertical-align:middle;|''Returns the numerical location of a given string in a string.''
     | {{tl|str find}}<br/>{{tl|strfind short}} |style2.2=vertical-align:middle;| 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.
Line 114: Line 115:
   |  <!---(Analysis cont'd)--->
   |  <!---(Analysis cont'd)--->
     {{Aligned table
     {{Aligned table
     |col1style=text-align:right;white-space:nowrap;padding-right:0.75em; |col2style=font-style:italic;
     |col1style=text-align:right;white-space:nowrap;padding-right:0.75em;
     | {{tl|ASCII code}}    | Returns the ASCII value of a single character.
     | {{tl|ASCII code}}    | Returns the ASCII value of a single character.
     | {{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|Isnumeric}}    | Returns number when true, blank when not numeric.
     | &nbsp; | &nbsp;
     | &nbsp; | &nbsp;
     | {{tl|Count on page}} | Counts how many times a string is used on a page  
     | {{tl|Count on page}} | Counts how many times a string is used on a page  
Line 122: Line 124:
     | &nbsp; | &nbsp;
     | &nbsp; | &nbsp;
     <!---(Technical)--->
     <!---(Technical)--->
    | [[Module:String]]    |
     | [[mw:Help:Magic words|...Magic words]] | {{noitalic|About <code><nowiki>{{padleft:&#124;}}</nowiki></code>.}}
     | [[mw:Help:Magic words|...Magic words]] | {{noitalic|About <code><nowiki>{{padleft:&#124;}}</nowiki></code>.}}
     | [[mw:Help:Extension:ParserFunctions|...ParserFunctions]] | {{noitalic|About <code><nowiki>{{#titleparts:&#124;}}, {{#expr:&#124;}}, {{#ifeq:&#124;}}, </nowiki></code> etc.}}
     | [[mw:Help:Extension:ParserFunctions|...ParserFunctions]] | {{noitalic|About <code><nowiki>{{#titleparts:&#124;}}, {{#expr:&#124;}}, {{#ifeq:&#124;}}, </nowiki></code> etc.}}
  }} }}
  }} }}
| group12 = Generic: [[:Module:String]]


<!--------------------- (disabled) ------------------------>
<!--------------------- (disabled) ------------------------>

Latest revision as of 14:49, 3 September 2020