Template:Str left long/doc: Difference between revisions

From Sarkarverse
Jump to navigation Jump to search
m (1 revision)
 
(clean up)
 
Line 3: Line 3:
<!-- Categories and interwikis go at the bottom of this page. -->
<!-- Categories and interwikis go at the bottom of this page. -->


The '''[[Template:Str_left_long]]''' is a general utility, as a string-handling utility template, to extract the left-hand side of long [[text string]]s beyond 500 to thousands of characters long, using a [[Lua script]] module.
The '''[[Template:Str left long]]''' is a general utility, as a string-handling utility template, to extract the left-hand side of long [[text string]]s beyond 500 to thousands of characters long, using a [[Lua script]] module.
__NOTOC__
__NOTOC__
== Usage ==
== Usage ==
Line 17: Line 17:


== Performance considerations ==
== Performance considerations ==
Because {str_left_long} uses a Lua module, it depends on the speed of the [[Lua script]] processing, which in February 2013, ran at the speed of 180 per second for repeated uses of {str_left_long}. By comparison, the [[wp:parser function]] {padleft:} runs at over 1,250 per second, to extract the left-hand side of a string, but only up to 500 long.
Because {str_left_long} uses a Lua module, it depends on the speed of the [[Lua script]] processing, which in February 2013, ran at the speed of 180 per second for repeated uses of {str_left_long}. By comparison, the [[SV:parser function]] {padleft:} runs at over 1,250 per second, to extract the left-hand side of a string, but only up to 500 long.


== See also ==
== See also ==
* [[Template:Str_left]] - extracts from short strings 1-500 long, 5x times faster
* [[Template:Str left]] - extracts from short strings 1-500 long, 5x times faster


<includeonly>
<includeonly>

Latest revision as of 07:38, 12 April 2014

The Template:Str left long is a general utility, as a string-handling utility template, to extract the left-hand side of long text strings beyond 500 to thousands of characters long, using a Lua script module.

Usage

{{str left long|abcdef|3}} gives: abc

Examples

  • {{str left long|abcdef|2}} gives: ab
  • {{str left long|abcdef|5}} gives: abcde
  • {{str left long|abcdef|0}} gives: [nothing]
  • {{str left long|abcdef|7}} gives:String Module Error: String subset index out of range
  • {{str left long|255.32|2}} gives: 25
  • {{str left long|..60,000 long...|59999}} gives: ...59,999 long...

Performance considerations

Because {str_left_long} uses a Lua module, it depends on the speed of the Lua script processing, which in February 2013, ran at the speed of 180 per second for repeated uses of {str_left_long}. By comparison, the SV:parser function {padleft:} runs at over 1,250 per second, to extract the left-hand side of a string, but only up to 500 long.

See also