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.
مثال
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 caused by the template depth limit (the character in a specific position of the given string is determined only if the preceding characters are all digits, hence the parser functiions are nested): if the result of finding the character in a specific position of the given string is an expansion depth error message, this message is not a digit.
طالع ايضا
قوالب التعامل مع النصوص
حسب الحساب {{Str mid }} To return a substring specified by position and length.
{{Trunc }} لحذف عدد محدد من الأحرف.
{{Str left }} To trim down to a specified number of characters or duplicate the string to a specified number.
{{Str crop }} لاقتصاص عدد محدد من الأحرف من النهاية.
{{chop head and tail }} لاقتصاص عدد محدد من الأحرف من البداية والنهاية
{{Str right }} لحذف اول عدد أو حرف
{{Str rightc }} To return a number of characters from the end, returns a parameter if the string is empty.
{{Str rightmost }} لحذف آخر عدد أو حرف من جملة.
{{Str sub old }} To trim down to a specified number, starting at a given number from the left.
{{str sub new }} Select a substr based on starting and ending index.
{{Str index }} Returns a given character from a string, but not accented letters.
حسب الفحص مخصص
{{WikiProjectbasename }} يحذف "مشروع ويكي" من اسم الصفحة.
{{Remove unranked }} Removes the string "unranked_" from the left of a string (taxonomy).
{{Ship prefix }} Returns the length of a ship's name prefix, if listed (ship names).
{{Title year }} يعود برقم السنة من عنوان الصفحة إن وجد.
إدخال، إبدال، وطول
{{strloc insert }} Inserts a string at character location strloc, or appends if strloc<=0.
{{حلقة }} Repeat character string a specified number of times.
{{حلقة }} يكرر سلسلة عدد محدد من المرات.
{{استبدل }} يستبدل نص بنص آخر.
{{Str rep }} Returns the string, after replacing the first occurrence of a specified string with another string.
{{Str len }} يعود بطول السلسلة.
{{اذا الطول أكبر من أو يساوي }} [if len]gth [g]reater than or [e]qual to.
{{Str ≥ len }} To check if a string is "longer or equally long" or "shorter" than a given length.
{{Str ≤ len }} To check if a string is "shorter or equally long" or "longer" than a given length.
{{str ≠ len }} To check if a string is "not equal" or "equal" to a given length.
{{str ≤ ≥ len }} To check if a string is "shorter", "equal", or "longer" than a given length.
تحليل وتقنيات
{{Str endswith }} To check if a string ends with a given string.
{{Str find }} {{Strfind short }} Returns the numerical location of a given string in a string.
{{إبحث }} البحث عن كلمة في جملة محددة.
{{Str sub find }} Searches a substring in a string at the given offset.
{{Str letter }} Returns the number of letters that begin a string.
{{Str number }} Returns the number of numbers that begin a string.
{{str gtr str }} Compares two strings for alphabetical order, and returns a value accordingly.
{{ASCII code }} Returns the ASCII value of a single character.
{{a or an }} Takes a noun and produces the appropriate indefinite article, based on whether the first letter is a vowel.
وحدة:String
...Magic words About {{padleft:|}}
.
...ParserFunctions About {{#titleparts:|}}, {{#expr:|}}, {{#ifeq:|}},
etc.
قوالب التعامل مع النصوص
حسب الحساب {{Str mid }} To return a substring specified by position and length.
{{Trunc }} لحذف عدد محدد من الأحرف.
{{Str left }} To trim down to a specified number of characters or duplicate the string to a specified number.
{{Str crop }} لاقتصاص عدد محدد من الأحرف من النهاية.
{{chop head and tail }} لاقتصاص عدد محدد من الأحرف من البداية والنهاية
{{Str right }} لحذف اول عدد أو حرف
{{Str rightc }} To return a number of characters from the end, returns a parameter if the string is empty.
{{Str rightmost }} لحذف آخر عدد أو حرف من جملة.
{{Str sub old }} To trim down to a specified number, starting at a given number from the left.
{{str sub new }} Select a substr based on starting and ending index.
{{Str index }} Returns a given character from a string, but not accented letters.
حسب الفحص مخصص
{{WikiProjectbasename }} يحذف "مشروع ويكي" من اسم الصفحة.
{{Remove unranked }} Removes the string "unranked_" from the left of a string (taxonomy).
{{Ship prefix }} Returns the length of a ship's name prefix, if listed (ship names).
{{Title year }} يعود برقم السنة من عنوان الصفحة إن وجد.
إدخال، إبدال، وطول
{{strloc insert }} Inserts a string at character location strloc, or appends if strloc<=0.
{{حلقة }} Repeat character string a specified number of times.
{{حلقة }} يكرر سلسلة عدد محدد من المرات.
{{استبدل }} يستبدل نص بنص آخر.
{{Str rep }} Returns the string, after replacing the first occurrence of a specified string with another string.
{{Str len }} يعود بطول السلسلة.
{{اذا الطول أكبر من أو يساوي }} [if len]gth [g]reater than or [e]qual to.
{{Str ≥ len }} To check if a string is "longer or equally long" or "shorter" than a given length.
{{Str ≤ len }} To check if a string is "shorter or equally long" or "longer" than a given length.
{{str ≠ len }} To check if a string is "not equal" or "equal" to a given length.
{{str ≤ ≥ len }} To check if a string is "shorter", "equal", or "longer" than a given length.
تحليل وتقنيات
{{Str endswith }} To check if a string ends with a given string.
{{Str find }} {{Strfind short }} Returns the numerical location of a given string in a string.
{{إبحث }} البحث عن كلمة في جملة محددة.
{{Str sub find }} Searches a substring in a string at the given offset.
{{Str letter }} Returns the number of letters that begin a string.
{{Str number }} Returns the number of numbers that begin a string.
{{str gtr str }} Compares two strings for alphabetical order, and returns a value accordingly.
{{ASCII code }} Returns the ASCII value of a single character.
{{a or an }} Takes a noun and produces the appropriate indefinite article, based on whether the first letter is a vowel.
وحدة:String
...Magic words About {{padleft:|}}
.
...ParserFunctions About {{#titleparts:|}}, {{#expr:|}}, {{#ifeq:|}},
etc.