Template:Str rightc/doc

From 'City of Adelaide' History and Genealogy Site
Jump to navigation Jump to search

{{#invoke:Message box|mbox}}

Usage

{{Str rightc|<string>|<count>}}
{{Str rightc|<string>|<count>|<result if empty>}}

Gives a substring of length <count> of characters from the right-side end of the string.

Examples

  • {{Str rightc| lorem ipsum dolor sit amet | 10 }} → {{safesubst:#invoke:String|sublength|s= lorem ipsum dolor sit amet |i={{#invoke:Math|max}}|len= 10 }}
  • {{Str rightc| lorem ipsum dolor sit amet | 1 }} → {{safesubst:#invoke:String|sublength|s= lorem ipsum dolor sit amet |i={{#invoke:Math|max}}|len= 1 }}
  • {{Str rightc| lorem ipsum dolor sit amet | 0 }} → {{safesubst:#invoke:String|sublength|s= lorem ipsum dolor sit amet |i={{#invoke:Math|max}}|len= 0 }}
  • {{Str rightc| | 1 | empty }} → empty
  • {{Str rightc |123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.1 | 99}} → {{safesubst:#invoke:String|sublength|s=123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.1 |i={{#invoke:Math|max}}|len= 99}}

TemplateData

This is the TemplateData documentation for this template used by VisualEditor and other tools.

Str rightc

<templatedata> {

       "description": "Gives the right most <count> characters of a string.",
       "params": {
               "1": {
                       "label": "String",
                       "description": "The string to be trimmed",
                       "type": "string",
                       "required": true
               },
               "2": {
                       "label": "Count",
                       "description": "The number of characters from the right to return",
                       "type": "number",
                       "required": true
               },
               "3": {
                       "label": "result if empty",
                       "description": "The result if the string is empty",
                       "type": "string",
                       "required": false
               }
       }

} </templatedata>

See also

{{#invoke:Navbox|navbox}}