Jump to content

మూస:str len

విక్షనరీ నుండి

The following documentation is located at Template:str len/doc. [edit]
Note: Please move the documentation subpage to Template:str len/documentation.


This is the {{str len}} meta-template.

It takes a string as parameter and returns its length (after stripping any leading and/or trailing whitespace). It can count up to 500 in length, and returns 500 for strings that are too long.

It must be subst:'d, so is only useful in new-entry-creation templates, subst:'d templates, and so on.

If the parameter is empty or undefined it is considered to be of zero length:

{{subst:str len}} becomes 0
{{subst:str len|}} becomes 0
{{subst:str len| }} becomes 0

It counts the length correctly, even if the string contains spaces, looks like a number, or contains special characters:

{{subst:str len| ab cde }} becomes 6
{{subst:str len| 1234567 }} becomes 7
{{subst:str len| café åäö }} becomes 8

It can measure strings up to 500 in length, and returns 500 for strings that are too long:

{{subst:str len| 499-characters... }} becomes 499
{{subst:str len| 1000-characters... }} becomes 500

MediaWiki has no parser function or magic word to measure string lengths, and measuring string length using template code is very heavy on the servers; thus this template, even though optimized about as much as it can be, must, by community decision, be subst:'d.

This template substitutes {{str len/core}}, which does most of the work. For documentation on the internal workings of these two templates see /core.

"https://te.wiktionary.org/w/index.php?title=మూస:str_len&oldid=282303" నుండి వెలికితీశారు