Материал c сайта НП «Викимедиа РУ»
{{{1}}}
Служит для замены символов в строках неограниченной длины.
{{replace|1234567890|5|x}} → 1234x67890
{{replace|1254565890|5|xy}} → 12xy4xy6xy890
{{replace|12545655555890|5|x}} → 12x4x6xxxxx890
{{replace|12545655555890|5|}} → 1246890
{{replace|12 4 6 890| |5}} → 12545655555890 ← замена пробелов
{{replace|12545655555890|5||count=3}} → 12465555890 ← замена ограниченного числа вхождений
См. также
 Шаблоны обработки строк (String-handling templates) |
|---|
|
|
|---|
| | By counting | | {{str mid|строка|N|L}} | Возвращает подстроку длиной L, начиная с позиции N.
{{str mid|строка|3|2}} → ро
| | {{trunc|строка|N}} | Возвращает заданное количество символов с начала строки. {{trunc|строка|3}} → стр
| | {{str left|строка|N}} | Возвращает заданное количество символов с начала строки. {{str left|строка|3}} → стр
| | {{str crop|строка|N}} | Удаляет справа из строки заданное количество символов. {{str crop|строка|1}} → строк
| | {{chop head and tail|строка|N}} | Удаляет с обеих сторон указанное число символов. {{chop head and tail|строка|2}} → ро
| | {{str right|строка|N}} | Возвращает символы начиная с N и до конца строки. {{str right|строка|2}} → рока
| | {{str rightc|строка|N}} | Возвращает правую часть строки из заданного количества символов. Результат как в {{str rightmost}}.
| | {{str rightmost|строка|N}} | {{str rightmost|строка|3}} → ока
| | {{str sub old|строка|N|L}} | Удаляет слева N символов и оставляет L.
{{str sub old|строка|2|3}} → рок
| | {{str sub new|строка|N|L}} | Выборает подстроку из строки на основе выбранных индексов.
{{str sub new|строка|3|5}} → рок
| | {{str index|строка|N}} | Возвращает из строки один символ под заданным номером N. {{str index|строка|4}} → о
|
|
|---|
| | By checking | |
|---|
| | Dedicated | | {{delink}} | Removes wikilink brackets (wikicode).
| | {{remove file prefix}} | Removes "File:" (or "Image:") from filenames.
| | {{PAGENAMEBASE}} | To trim off any parenthesis text at the end of a string (disambiguation).
| | {{title disambig text}} | Returns text in parenthesis at the end of a string (disambiguation).
| | {{WikiProjectbasename}} | Removes "WikiProject" from a pagename.
| | {{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}} | Returns the 4-digit year from a pagename, if any.
|
|
|---|
|
|
|
Вставка и замена строк |
|---|
| | {{strloc insert}} | Inserts a string at character location strloc, or appends if strloc<=0.
| | {{loop}} | Repeat character string a specified number of times.
| | {{repeat}} | Repeat a string a specified number of times.
| | {{replace}} | Returns the string, after replacing all occurrences of a specified string with another string.
| | {{str rep}} | Returns the string, after replacing the first occurrence of a specified string with another string.
| | {{str len|строка}} | Возвращает длину строки. {{Str len|строка}} → 6
| | {{iflenge}} | [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.
|
|
|
|
Analysis and technical |
|---|
| | {{str endswith}} | To check if a string ends with a given string.
| {{str find}} {{strfind short}}
| Позиция первого вхождения подстроки в текст.
| | {{str find0}} | Zero-based substring search.
| | {{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.
| | |
| | Module:String |
| | ...Magic words
| About {{padleft:|}}.
| | ...ParserFunctions
| About {{#titleparts:|}}, {{#expr:|}}, {{#ifeq:|}}, etc.
|
|
|
|
|