साँचा:Str left

Wikibooks से
Jump to navigation Jump to search
साँचा प्रलेखन[सम्पादन] [इतिहास] [ताजा करें]

Usage[सम्पादन]

{{Str left|<string>|<count>}}

Gives the resultant <count> of characters creating a substring of characters from the start of the trimmed string (i.e. the substring returned will have length <count>, exclusive of leading whitespace characters, which are trimmed first before <count> is invoked).

If <count> is invalid or empty, an empty string is returned. If undefined, it defaults to 1.

Limitations[सम्पादन]

  • Length to 500: The maximum substring stops at 500 long, yet gives no error message. Only 500 characters can be extracted even if the <string> is longer.
  • Inexpensive (uses no other templates).

Examples[सम्पादन]

  • {{Str left| Lorem ipsum dolor sit amet | 10 }} → Lorem ipsu
  • {{Str left|   Lorem ipsum dolor sit amet | 4 }} → Lore, (note leading spaces trimmed!)
  • {{Str left| Lorem ipsum dolor sit amet | 1 }} → L
  • {{Str left| Lorem ipsum dolor sit amet | 0 }}
  • {{Str left| Lorem ipsum dolor sit amet | }}
  • {{Str left| Lorem ipsum dolor sit amet }} → L
  • {{Str left| Lorem ipsum dolor sit amet | 40 }} → Lorem ipsum dolor sit ametLorem ipsum do

See also[सम्पादन]

साँचा:String templates see also