Jump to content

Template:Str rightc/doc

From Wikihoc

Lua error in Module:Effective_protection_level at line 64: attempt to index field 'ext' (a nil value).

{{#ifeq:doc |doc

    | 

{{#ifeq:show |show

|

        }}{{#if:|
         |{{#ifexist:Template:Str rightc
                  | [[Category:{{#switch:Template |Template=Template |Module=Module |User=User |#default=Wikipedia}} documentation pages]]
                  | 
                 }}
        }}
    | 
   }}

Usage

{{str rightc|string|count}}
{{str rightc|string|count|result if empty}}

Gives a substring of length count characters from the right-side end of the string, or, if provided, returns result if empty when string is empty.

Examples

  • <syntaxhighlight inline lang="wikitext">{{safesubst:#switch:{{safesubst:#if:Lorem ipsum dolor sit amet |a}}{{safesubst:#iferror:{{safesubst:#ifexpr:10>0|b}}|c}}

|ab=r sit amet |ac=Lorem ipsum dolor sit amet |a= |}}</syntaxhighlight> → {{safesubst:#switch:{{safesubst:#if:Lorem ipsum dolor sit amet |a}}{{safesubst:#iferror:{{safesubst:#ifexpr:10>0|b}}|c}} |ab=r sit amet |ac=Lorem ipsum dolor sit amet |a= |}}

  • <syntaxhighlight inline lang="wikitext">{{safesubst:#switch:{{safesubst:#if:Lorem ipsum dolor sit amet |a}}{{safesubst:#iferror:{{safesubst:#ifexpr:1>0|b}}|c}}

|ab=t |ac=Lorem ipsum dolor sit amet |a= |}}</syntaxhighlight> → {{safesubst:#switch:{{safesubst:#if:Lorem ipsum dolor sit amet |a}}{{safesubst:#iferror:{{safesubst:#ifexpr:1>0|b}}|c}} |ab=t |ac=Lorem ipsum dolor sit amet |a= |}}

  • <syntaxhighlight inline lang="wikitext">{{safesubst:#switch:{{safesubst:#if:Lorem ipsum dolor sit amet |a}}{{safesubst:#iferror:{{safesubst:#ifexpr:0>0|b}}|c}}

|ab=Lorem ipsum dolor sit amet |ac=Lorem ipsum dolor sit amet |a= |}}</syntaxhighlight> → {{safesubst:#switch:{{safesubst:#if:Lorem ipsum dolor sit amet |a}}{{safesubst:#iferror:{{safesubst:#ifexpr:0>0|b}}|c}} |ab=Lorem ipsum dolor sit amet |ac=Lorem ipsum dolor sit amet |a= |}}

  • <syntaxhighlight inline lang="wikitext">{{safesubst:#switch:{{safesubst:#if: |a}}{{safesubst:#iferror:{{safesubst:#ifexpr:1 >0|b}}|c}}

|ab= |ac= |a= |string is empty}}</syntaxhighlight> → {{safesubst:#switch:{{safesubst:#if: |a}}{{safesubst:#iferror:{{safesubst:#ifexpr:1 >0|b}}|c}} |ab= |ac= |a= |string is empty}}

  • <syntaxhighlight inline lang="wikitext">{{safesubst:#switch:{{safesubst:#if:123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-1 |a}}{{safesubst:#iferror:{{safesubst:#ifexpr:99>0|b}}|c}}

|ab=3456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-1 |ac=123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-1 |a= |}}</syntaxhighlight> → {{safesubst:#switch:{{safesubst:#if:123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-1 |a}}{{safesubst:#iferror:{{safesubst:#ifexpr:99>0|b}}|c}} |ab=3456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-1 |ac=123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-1 |a= |}}

TemplateData

{{#if:|{{#switch:
|=[https://bambots.brucemyers.com/TemplateParam.php?wiki=enwiki&template=%7B%7B%23if%3AStr+rightc%7CStr+rightc%7CStr+rightc%7D%7D {{#ifeq:{{safesubst:#switch: {{{lc}}}
|no
|n
|f
|false
|off
|0        = no
|         = no
|¬        = no
|yes
|y
|t
|true
|on
|1        = yes
|#default = no

}}|no|S|s}}ee a monthly parameter usage report] for {{#if:Str rightc|Template:Str rightc|this template}} in articles{{#ifeq:{{safesubst:#switch: y

|no
|n
|f
|false
|off
|0        = no
|         = no
|¬        = no
|yes
|y
|t
|true
|on
|1        = yes
|#default = no

}}|yes| based on {{#if:Str rightc|its|this}} TemplateData}}.

|None|none=[https://bambots.brucemyers.com/TemplateParam.php?wiki=enwiki&template=%7B%7B%23if%3AStr+rightc%7CStr+rightc%7CStr+rightc%7D%7D {{#ifeq:{{safesubst:#switch: {{{lc}}}
|no
|n
|f
|false
|off
|0        = no
|         = no
|¬        = no
|yes
|y
|t
|true
|on
|1        = yes
|#default = no

}}|no|P|p}}arameter usage report]{{#ifeq:{{safesubst:#switch: y

|no
|n
|f
|false
|off
|0        = no
|         = no
|¬        = no
|yes
|y
|t
|true
|on
|1        = yes
|#default = no

}}|yes| based on {{#if:Str rightc|its|this}} TemplateData}}

|for|For=[https://bambots.brucemyers.com/TemplateParam.php?wiki=enwiki&template=%7B%7B%23if%3AStr+rightc%7CStr+rightc%7CStr+rightc%7D%7D {{#ifeq:{{safesubst:#switch: {{{lc}}}
|no
|n
|f
|false
|off
|0        = no
|         = no
|¬        = no
|yes
|y
|t
|true
|on
|1        = yes
|#default = no

}}|no|P|p}}arameter usage report] for {{#if:Str rightc|Template:Str rightc|Template:Str rightc}}{{#ifeq:{{safesubst:#switch: y

|no
|n
|f
|false
|off
|0        = no
|         = no
|¬        = no
|yes
|y
|t
|true
|on
|1        = yes
|#default = no

}}|yes| based on {{#if:Str rightc|its|this}} TemplateData}}.

|#default=[1]{{#ifeq:{{safesubst:#switch: y
|no
|n
|f
|false
|off
|0        = no
|         = no
|¬        = no
|yes
|y
|t
|true
|on
|1        = yes
|#default = no

}}|yes| based on {{#if:Str rightc|its|this}} TemplateData}} }}|This is the {{#if:|TemplateData|TemplateData}} for this template used by TemplateWizard, VisualEditor and other tools. {{#switch:

|=[https://bambots.brucemyers.com/TemplateParam.php?wiki=enwiki&template=%7B%7B%23if%3AStr+rightc%7CStr+rightc%7CStr+rightc%7D%7D {{#ifeq:{{safesubst:#switch: {{{lc}}}
|no
|n
|f
|false
|off
|0        = no
|         = no
|¬        = no
|yes
|y
|t
|true
|on
|1        = yes
|#default = no

}}|no|S|s}}ee a monthly parameter usage report] for {{#if:Str rightc|Template:Str rightc|this template}} in articles{{#ifeq:{{safesubst:#switch: y

|no
|n
|f
|false
|off
|0        = no
|         = no
|¬        = no
|yes
|y
|t
|true
|on
|1        = yes
|#default = no

}}|yes| based on {{#if:Str rightc|its|this}} TemplateData}}.

|None|none=[https://bambots.brucemyers.com/TemplateParam.php?wiki=enwiki&template=%7B%7B%23if%3AStr+rightc%7CStr+rightc%7CStr+rightc%7D%7D {{#ifeq:{{safesubst:#switch: {{{lc}}}
|no
|n
|f
|false
|off
|0        = no
|         = no
|¬        = no
|yes
|y
|t
|true
|on
|1        = yes
|#default = no

}}|no|P|p}}arameter usage report]{{#ifeq:{{safesubst:#switch: y

|no
|n
|f
|false
|off
|0        = no
|         = no
|¬        = no
|yes
|y
|t
|true
|on
|1        = yes
|#default = no

}}|yes| based on {{#if:Str rightc|its|this}} TemplateData}}

|for|For=[https://bambots.brucemyers.com/TemplateParam.php?wiki=enwiki&template=%7B%7B%23if%3AStr+rightc%7CStr+rightc%7CStr+rightc%7D%7D {{#ifeq:{{safesubst:#switch: {{{lc}}}
|no
|n
|f
|false
|off
|0        = no
|         = no
|¬        = no
|yes
|y
|t
|true
|on
|1        = yes
|#default = no

}}|no|P|p}}arameter usage report] for {{#if:Str rightc|Template:Str rightc|Template:Str rightc}}{{#ifeq:{{safesubst:#switch: y

|no
|n
|f
|false
|off
|0        = no
|         = no
|¬        = no
|yes
|y
|t
|true
|on
|1        = yes
|#default = no

}}|yes| based on {{#if:Str rightc|its|this}} TemplateData}}.

|#default=[2]{{#ifeq:{{safesubst:#switch: y
|no
|n
|f
|false
|off
|0        = no
|         = no
|¬        = no
|yes
|y
|t
|true
|on
|1        = yes
|#default = no

}}|yes| based on {{#if:Str rightc|its|this}} TemplateData}} }}}}

TemplateData for Str rightc

{{#switch:

 {{#if:
 | {{{demospace}}}    
 | {{#ifeq:Template|Template
   | template
   | other
   }}
 }}

| template = {{safesubst:#if:{{safesubst:#ifeq:doc|sandbox|1}}{{safesubst:#ifeq:doc|doc|1}}||

}} | other | #default = }} <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