टेम्पलेट:Str number/doc: रिवीजन सभ के बीचा में अंतर

विकिपीडिया से
Content deleted Content added
→‎Examples: The maximum is reduced if the template is called in a template parameter:
This is because if the result of finding the character in a specific position of the given string is an error message, this message is not a digit.
लाइन 32: लाइन 32:
The maximum is reduced if the template is called in a template parameter:
The maximum is reduced if the template is called in a template parameter:
:<code><nowiki>{{1x|{{str number|1234567890123456789012345}}}}</nowiki></code> returns {{1x|{{str number|1234567890123456789012345}}}}
:<code><nowiki>{{1x|{{str number|1234567890123456789012345}}}}</nowiki></code> returns {{1x|{{str number|1234567890123456789012345}}}}
This is because if the result of finding the character in a specific position of the given string is an error message, this message is not a digit.

=== See also ===
=== See also ===
{{String templates see also}}
{{String templates see also}}

09:55, 8 दिसंबर 2010 तक ले भइल बदलाव

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

It takes a string as parameter, and returns the number of leading digits. It can count up to 25, and returns 25 if there are more.

Examples

If the parameter is empty or undefined, zero is returned:

{{str number}} returns 0
{{str number|}} returns 0
{{str number| }} returns 0

The count is interrupted by anything but the ten digits:

{{str number|abcde}} returns 0
{{str number|123456}} returns 6
{{str number|123 456}} returns 3
{{str number|1234abc}} returns 4
{{str number|1234abc56}} returns 4

If there are more than 24 leading digits, 25 is returned:

{{str number|123456789012345678901234}} returns 24
{{str number|1234567890123456789012345}} returns 25
{{str number|12345678901234567890123456}} returns 26
{{str number|123456789012345678901234a}} returns 24
{{str number|1234567890123456789012345a}} returns 25
{{str number|12345678901234567890123456a}} returns 26

The maximum is reduced if the template is called in a template parameter:

{{1x|{{str number|1234567890123456789012345}}}} returns 25

This is because if the result of finding the character in a specific position of the given string is an error message, this message is not a digit.

See also

टेम्पलेट:String templates see also