Difference between revisions of "Template:Str right/doc"

From Ava Zinn Wiki
Jump to: navigation, search
[unchecked revision][unchecked revision]
(sl:Predloga:Str right)
m (51 revisions)
 
(14 intermediate revisions by 11 users not shown)
Line 1: Line 1:
 
{{Documentation subpage}}
 
{{Documentation subpage}}
 +
{{Lua|Module:String}}
 
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
 
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
  
=== Usage ===
+
== Usage ==
  
: <code>{{Tlx|Str right|<string>|<offset>}}</code>
+
: {{tlx|str right|<string>|<offset>}}
  
 
Gives the characters from <offset> to the end of the string.
 
Gives the characters from <offset> to the end of the string.
Line 12: Line 13:
 
If <offset> is longer than <string> then this returns an empty 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 don't do that.
+
If <offset> is invalid, empty or undefined, this template goes berserk, so please avoid.
  
=== Limitations ===  
+
===Examples===
* Up to 100 chararacters in the input string. If possible, first check length of input string using {{Tl|Str len|<string>}}. Using strings longer than 100 characters may result in the error '''''"<font color=#CC1100>max index is 100 for str_sub</font>"'''''.
+
* <code><nowiki>{{str right |Lorem ipsum dolor sit amet |10}}</nowiki></code> &rarr; {{str right |Lorem ipsum dolor sit amet |10}}
* Limited set of characters.
+
* <code><nowiki>{{str right |Lorem ipsum dolor sit amet |1}}</nowiki></code> &rarr; {{str right |Lorem ipsum dolor sit amet |1}}
* Expensive.
+
* <code><nowiki>{{str right |Lorem ipsum dolor sit amet |0}}</nowiki></code> &rarr; {{str right |Lorem ipsum dolor sit amet |0}}
 +
* <code><nowiki>{{str right |123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.1 |99}}</nowiki></code> &rarr; {{str right |nocategory=true |123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.1 |99}}
  
=== Examples ===
+
== TemplateData ==
  
*<tt><nowiki>{{Str right| lorem ipsum dolor sit amet | 10 }}</nowiki></tt> &rarr; {{Str right| lorem ipsum dolor sit amet | 10 }}
+
{{TemplateDataHeader}}
*<tt><nowiki>{{Str right| lorem ipsum dolor sit amet | 1 }}</nowiki></tt> &rarr; {{Str right| lorem ipsum dolor sit amet | 1 }}
+
<templatedata>
*<tt><nowiki>{{Str right| lorem ipsum dolor sit amet | 0 }}</nowiki></tt> &rarr; {{Str right| lorem ipsum dolor sit amet | 0 }}
+
{
*<tt><nowiki>{{Str right |123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.1 | 99}}</nowiki></tt> &rarr; {{Str rightc |nocategory=true |123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.1 | 99}}
+
        "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 {{str rightc}} to trim the right n characters. If its greater than the string length returns the empty string.",
 +
                        "type": "number",
 +
                        "required": true
 +
                }
 +
        }
 +
}
 +
</templatedata>
  
=== See also ===
+
== See also ==
{{String templates see also}}
+
* {{tl|str rightc}}
 +
* {{tl|str rightmost}}
 +
* {{tl|str left}}
 +
 
 +
{{String-handling templates |trim}}
  
 
<includeonly>
 
<includeonly>
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
+
<!----CATEGORIES BELOW THIS LINE, PLEASE:---->
 
[[Category:String manipulation templates]]
 
[[Category:String manipulation templates]]
[[ar:قالب:Str right]]
+
 
[[cy:Nodyn:Str right]]
+
[[bn:টেমপ্লেট:Str right]]
[[es:Plantilla:Str right]]
 
[[id:Templat:Str right]]
 
[[ja:Template:Str right]]
 
[[ru:Шаблон:Str right]]
 
[[ur:Template:Str right]]
 
[[sl:Predloga:Str right]]
 
 
</includeonly>
 
</includeonly>

Latest revision as of 08:34, 5 December 2016

Gnome-utilities-terminal.svg This template uses (or will be using) Lua programming language.

Please see Wikipedia:Lua if you want to learn more about Lua or help convert other templates.

Usage[edit]

{{str right|<string>|<offset>}}

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[edit]

  • {{str right |Lorem ipsum dolor sit amet |10}}Expression error: Unrecognized punctuation character "{".
  • {{str right |Lorem ipsum dolor sit amet |1}}Expression error: Unrecognized punctuation character "{".
  • {{str right |Lorem ipsum dolor sit amet |0}}Expression error: Unrecognized punctuation character "{".
  • {{str right |123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.1 |99}}Expression error: Unrecognized punctuation character "{".

TemplateData[edit]

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

Str right

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

Template parameters

ParameterDescriptionTypeStatus
String1

The string to be trimmed

Default
empty
Example
empty
Auto value
empty
Stringrequired
Count2

The index of the character to trim from. Negative values are treated as 0, see {{str rightc}} to trim the right n characters. If its greater than the string length returns the empty string.

Default
empty
Example
empty
Auto value
empty
Numberrequired

See also[edit]