Module:Str rightc/doc
Appearance
| This is a documentation subpage for Module:Str rightc. It may contain usage information, categories and other content that is not part of the original module page. |
| This module is rated as ready for general use. It has reached a mature state, is considered relatively stable and bug-free, and may be used wherever appropriate. It can be mentioned on help pages and other Wikipedia resources as an option for new users. To minimise server load and avoid disruptive output, improvements should be developed through sandbox testing rather than repeated trial-and-error editing. |
| This Lua module is used in system messages. Changes to it can cause immediate changes to the Wikipedia user interface. To avoid major disruption, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Please discuss changes on the talk page before implementing them. |
This implements: {{str rightc}} but if |notemplate= is set to a non-empty string, arguments from the invocation can be used.
Usage
[edit]{{#invoke:str rightc|rightc|notemplate=1|string|count}}{{#invoke:str rightc|rightc|notemplate=1|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
[edit]{{#invoke:str rightc|rightc|notemplate=1 |Lorem ipsum dolor sit amet |10}}→ r sit amet{{#invoke:str rightc|rightc|notemplate=1 |Lorem ipsum dolor sit amet |1}}→ t{{#invoke:str rightc|rightc|notemplate=1 |Lorem ipsum dolor sit amet |0}}→{{#invoke:str rightc|rightc|notemplate=1 | |1 |string is empty}}→ string is empty{{#invoke:str rightc|rightc|notemplate=1 |123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-1 |99}}→ 3456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-1