ഫലകം:Strloc prefix

വിക്കിപീഡിയ, ഒരു സ്വതന്ത്ര വിജ്ഞാനകോശം.
Jump to navigation Jump to search

{{{1}}}

[തിരുത്തുക] [പുതുക്കുക] ഫലകത്തിന്റെ വിവരണം

The string-prefixer Template:Strloc_prefix gets the prefix of a string up to a specified location, or the entire string when location is less than 1.

Usage[തിരുത്തുക]

{{Strloc prefix|<string1>|strloc=<n>}}

Returns the prefix of string1 up to location strloc=n, where n = 1 denotes the first character of the string. If strloc <= 0 then the entire string1 is the result. The parameter strloc can be a math formula, such as: strloc={{{len}}}-2, or strloc=abs(-2*5)+6.

Examples[തിരുത്തുക]

The following show various uses:

  • {{Strloc prefix|abcdef|strloc=3}} → abc
  • {{Strloc prefix|abcdef|strloc=0}} → abcdef
  • {{Strloc prefix|My Title (film)|strloc= {{strfind_short|My Title (film)|(|1|lenstr={{strlen_quick|My Title (film)}}|}}-2}} → My Title
In the example with "{{strfind_short}}: the number for strloc was set by finding "(" in the
title. If there had been no parenthesis "(" then the result would get the entire title.

Limitations[തിരുത്തുക]

The text extracted is subject to the limitations of parser functions {#ifexpr:} and {padleft:}. In particular, spaces around the prefixed string are dropped, and NOT counted, before or after:

  • {{Strloc prefix| Title here |strloc=9}}   → "Title her"
  • {{Strloc prefix| Title here |strloc=0}}   → "Title here"

Spaces embedded within the prefix string are real spaces (NOT "&#32;"), and any accented or special characters can be used in the string.

See also[തിരുത്തുക]

Description of all string templates

"https://ml.wikipedia.org/w/index.php?title=ഫലകം:Strloc_prefix&oldid=1123674" എന്ന താളിൽനിന്ന് ശേഖരിച്ചത്