Пређи на садржај

Шаблон:Str right/док

Iz Vojne Enciklopedije

{{#ifeq:док |док

    | 

{{#ifeq:show |show

|

        }}{{#if: |
         |   {{#ifexist:Шаблон:Str right
                  | [[Категорија:Документација {{#switch:Шаблон |Шаблон=шаблона |Модул=модула |Корисник=корисничких страница |#default=Википедије}}]]
                  | 
                 }}
        }}
    | 
   }}

Usage

{{{{#if: |замени:}}str right{{#if:<string> ||<string>}}{{#if:<offset> ||<offset>}}{{#if: ||{{{4}}}}}{{#if: ||{{{5}}}}}{{#if: ||{{{6}}}}}{{#if: ||{{{7}}}}}{{#if: ||{{{8}}}}}{{#if: ||{{{9}}}}}{{#if: ||{{{10}}}}}{{#if: ||{{{11}}}}}{{#if: ||{{{12}}}}}{{#if: ||{{{13}}}}}{{#if: ||{{{14}}}}}{{#if: ||{{{15}}}}}{{#if: ||{{{16}}}}}{{#if: ||{{{17}}}}}{{#if: ||{{{18}}}}}{{#if: ||{{{19}}}}}{{#if: ||{{{20}}}}}{{#if: ||...}}}}

Gives the characters from <offset> to the end of the string.

A negative <offset> is treated the same as zero, which simply returns the original string.

If <offset> is longer than <string> then this returns an empty string.

If <offset> is invalid, empty or undefined, this template goes berserk, so please avoid.

Examples

  • {{str right |Lorem ipsum dolor sit amet |10}} → {{safesubst:#ifexpr: 10 < 0

|Lorem ipsum dolor sit amet |{{safesubst:#ifexpr: 10+1 > 26 | | Lorem ipsum dolor sit amet }} }}

  • {{str right |Lorem ipsum dolor sit amet |1}} → {{safesubst:#ifexpr: 1 < 0

|Lorem ipsum dolor sit amet |{{safesubst:#ifexpr: 1+1 > 26 | | Lorem ipsum dolor sit amet }} }}

  • {{str right |Lorem ipsum dolor sit amet |0}} → {{safesubst:#ifexpr: 0 < 0

|Lorem ipsum dolor sit amet |{{safesubst:#ifexpr: 0+1 > 26 | | Lorem ipsum dolor sit amet }} }}

  • {{str right |123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.1 |99}} → {{safesubst:#ifexpr: 99 < 0

|123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.1 |{{safesubst:#ifexpr: 99+1 > 101 | | 123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.1 }} }}

TemplateData

{{#if:|погледајте месечни извештај о грешкама за овај шаблон.|Ово је {{#if:|TemplateData|TemplateData}} документација за овај шаблон, коришћена у Визуелном уређивачу и у другим алаткама; погледајте месечни извештај о грешкама за овај шаблон.}}

TemplateData за Str right

{{#ifeq:док|sandbox||

}} <templatedata> {

       "description": "Gives the characters from <offset> to the end of the string.",
       "params": {
               "1": {
                       "label": "String",
                       "description": "The string to be trimmed",
                       "type": "string",
                       "required": true
               },
               "2": {
                       "label": "Count",
                       "description": "The index of the character to trim from. Negative values are treated as 0, see {{#if:|{{{1}}}|}} to trim the right n characters. If its greater than the string length returns the empty string.",
                       "type": "number",
                       "required": true
               }
       }

} </templatedata>

See also