Шаблон:Шаблоны обработки строк: различия между версиями
Перейти к навигации
Перейти к поиску
imported>Grain of sand м (Grain of sand переименовал страницу Шаблон:String-handling templates в Шаблон:Шаблоны обработки строк поверх перенаправления: РЯ) |
imported>Grain of sand (ч. 1) |
||
Строка 1: | Строка 1: | ||
{{ | {{Навигационная таблица с блоками | ||
| | | имя = Шаблоны обработки строк | ||
| state = {{{state|uncollapsed}}} | | state = {{{state|uncollapsed}}} | ||
| | | заголовок = Шаблоны обработки строк | ||
| selected = {{{selected|{{{expanded|{{{1|}}}}}}}}} | | selected = {{{selected|{{{expanded|{{{1|}}}}}}}}} | ||
| | | блок1 = [[Trim|Обрезка строки]] | ||
| | | список1 = | ||
{{ | {{Навигационная таблица|child | ||
| | | группа1 = By counting | ||
| | | список1 = {{Aligned table |style=padding-right:0.5em; | ||
|col1style=width:12em; text-align:right;white-space:nowrap;padding-right:0.5em; | |col1style=width:12em; text-align:right;white-space:nowrap;padding-right:0.5em; | ||
|col2style=font-style:italic; | |col2style=font-style:italic; | ||
| {{tp|_nav=x|str mid|строка|N|L}}| Возвращает подстроку длиной L, начиная с позиции N. <br | | {{tp|_nav=x|str mid|строка|N|L}} | Возвращает подстроку длиной L, начиная с позиции N. <br>{{пример|str mid|строка|3|2}} | ||
| {{tp|_nav=x|trunc|строка|N}}| Возвращает заданное количество символов с начала строки.<br | | {{tp|_nav=x|trunc|строка|N}} | Возвращает заданное количество символов с начала строки.<br> {{пример|trunc|строка|3}} | ||
| {{tp|_nav=x|str left|строка|N}}| Возвращает заданное количество символов с начала строки.<br | | {{tp|_nav=x|str left|строка|N}} | Возвращает заданное количество символов с начала строки.<br> {{пример|str left|строка|3}} | ||
| {{tp|_nav=x|str crop|строка|N}}| Удаляет справа из строки заданное количество символов.<br | | {{tp|_nav=x|str crop|строка|N}} | Удаляет справа из строки заданное количество символов.<br> {{пример|str crop|строка|1}} | ||
| {{tp|_nav=x| | | {{tp|_nav=x|обрезать слева и справа|строка|N}} | Удаляет с обеих сторон указанное число символов.<br> {{пример|обрезать слева и справа|строка|2}} | ||
| {{tp|_nav=x|str right|строка|N}} | Возвращает символы начиная с N и до конца строки.<br | | {{tp|_nav=x|str right|строка|N}} | Возвращает символы начиная с N и до конца строки.<br> {{пример|str right|строка|2}} | ||
| {{tp|_nav=x|str rightc|строка|N}} | Возвращает правую часть строки из заданного количества символов. Результат как в {{t|str rightmost}}. | | {{tp|_nav=x|str rightc|строка|N}} | Возвращает правую часть строки из заданного количества символов. Результат как в {{t|str rightmost}}. | ||
| {{tp|_nav=x|str rightmost|строка|N}} | | | {{tp|_nav=x|str rightmost|строка|N}} | {{пример|str rightmost|строка|3}} | ||
| {{tp|_nav=x|str sub | | {{tp|_nav=x|str sub|строка|N|L}} | Удаляет слева N символов и оставляет L. <br>{{пример|str sub|строка|2|3}} | ||
| {{tp|_nav=x|str sub new|строка|N|L}} | | | {{tp|_nav=x|str sub new|строка|N|L}} | Выбирает подстроку из строки на основе выбранных индексов.<br>{{пример|str sub new|строка|3|5}} | ||
| {{tp|_nav=x|str index|строка|N}} | | {{tp|_nav=x|str index|строка|N}} | Возвращает из строки один символ под заданным номером N. <br> {{пример|str index|строка|4}} | ||
}} | }} | ||
| | | группа2 = By checking | ||
| | | список2 = | ||
{{Aligned table |style=padding-right:0.5em; | {{Aligned table |style=padding-right:0.5em; | ||
|col1style=width:12em; text-align:right; white-space:nowrap; padding-right:0.5em; | |col1style=width:12em; text-align:right; white-space:nowrap; padding-right:0.5em; | ||
|col2style=font-style:italic; | |col2style=font-style:italic; | ||
| {{tnav|trim}} | | {{tnav|str trim}} | Удаляет пробелы справа и слева.<br> {{пример|str trim| строка }} | ||
| | |||
| {{tnav|trim brackets}} | To trim any leading or trailing square brackets. | | {{tnav|trim brackets}} | To trim any leading or trailing square brackets. | ||
| {{tnav| | | {{tnav|первое слово}} | Возвращает первое слово в строке. | ||
| {{tnav|remove first word}} | To remove anything before the first space. | | {{tnav|remove first word}} | To remove anything before the first space. | ||
| {{tnav| | | {{tnav|последнее слово}} | Возвращает последнее слово в строке. | ||
| {{tnav|remove last word}} | To remove anything after the last space. | | {{tnav|remove last word}} | To remove anything after the last space. | ||
}} | }} | ||
| | | группа3 = Dedicated | ||
| | | список3 = | ||
{{Aligned table |style=padding-right:0.5em; | {{Aligned table |style=padding-right:0.5em; | ||
|col1style=width:12em; text-align:right;white-space:nowrap;padding-right:0.5em; | |col1style=width:12em; text-align:right;white-space:nowrap;padding-right:0.5em; | ||
|col2style=font-style:italic; | |col2style=font-style:italic; | ||
| {{tnav|delink}} | | | {{tnav|delink}} | Удаляет вики-ссылки из текста | ||
| {{tnav|remove file prefix}} | Вырезает "File:", "Файл:", "Image:" и "Изображение:" с названия файла. | | {{tnav|remove file prefix}} | Вырезает "File:", "Файл:", "Image:" и "Изображение:" с названия файла. | ||
| {{tnav| | | {{tnav|без уточнения}} | Убирает уточнение в скобках из строки, если таковое имеется. | ||
| {{tnav|год из заголовка}} | Возвращает первое четырехзначное число из заголовка | |||
| {{tnav| | |||
}} }} | }} }} | ||
| | | группа4 = Вставка и замена строк | ||
| | | список4 = | ||
{{Aligned table |style=padding-right:0.5em; | {{Aligned table |style=padding-right:0.5em; | ||
|col1style=width:9em; text-align:right; white-space:nowrap; padding-right:0.5em; background:#F6F6F6; | |col1style=width:9em; text-align:right; white-space:nowrap; padding-right:0.5em; background:#F6F6F6; | ||
Строка 75: | Строка 67: | ||
| {{tnav|strloc insert}} | Inserts a string at character location strloc, or appends if strloc<{{=}}0. | | {{tnav|strloc insert}} | Inserts a string at character location strloc, or appends if strloc<{{=}}0. | ||
| {{tnav|loop}} | Repeat character string a specified number of times. | | {{tnav|loop}} | Repeat character string a specified number of times. | ||
| {{tnav| | | {{tnav|multi}} | Repeat a string a specified number of times. | ||
| {{tnav|replace}} | Returns the string, after replacing ''all'' occurrences of a specified string with another string. | | {{tnav|replace}} | Returns the string, after replacing ''all'' occurrences of a specified string with another string. | ||
| {{tnav|str rep}} | Returns the string, after replacing the first occurrence of a specified string with another string. | | {{tnav|str rep}} | Returns the string, after replacing the first occurrence of a specified string with another string. | ||
| {{tp|_nav=x|str len|строка}} | Возвращает длину строки. | | {{tp|_nav=x|str len|строка}} | Возвращает длину строки. {{пример|Str len|строка}} {{Str len|строка}} | ||
|{{tnav|iflenge}} | [if len]gth [g]reater than or [e]qual to. | |{{tnav|iflenge}} | [if len]gth [g]reater than or [e]qual to. | ||
|{{tnav|str ≥ len}} | To check if a string is "longer or equally long" or "shorter" than a given length. | |{{tnav|str ≥ len}} | To check if a string is "longer or equally long" or "shorter" than a given length. | ||
Строка 86: | Строка 78: | ||
}} | }} | ||
| | | группа5 = Analysis and technical | ||
| | | список5 = | ||
{{Aligned table |style=padding-right:0.5em; | |||
{{Aligned table |style= | |||
|col1style=width:9em; text-align:right; white-space:nowrap; padding-right:0.5em; background:#F6F6F6; | |col1style=width:9em; text-align:right; white-space:nowrap; padding-right:0.5em; background:#F6F6F6; | ||
|col2style= font-style:italic; | |col2style=text-align:left;font-style:italic; | ||
| {{tnav|str endswith}} | To check if a string ends with a given string. | | {{tnav|str endswith}} | To check if a string ends with a given string. | ||
| {{tnav|str find}}<br>{{tnav|strfind short}} | | {{tnav|str find}}<br>{{tnav|strfind short}} | ||
Строка 101: | Строка 92: | ||
| {{tnav|str gtr str}} | Compares two strings for alphabetical order, and returns a value accordingly. | | {{tnav|str gtr str}} | Compares two strings for alphabetical order, and returns a value accordingly. | ||
| {{tnav|ASCII code}} | Returns the ASCII value of a single character. | | {{tnav|ASCII code}} | Returns the ASCII value of a single character. | ||
| | | | | | ||
| [[Module:String]] | | | [[Module:String]] | | ||
Строка 108: | Строка 98: | ||
| [[mw:Help:Extension:ParserFunctions|...ParserFunctions]] | | [[mw:Help:Extension:ParserFunctions|...ParserFunctions]] | ||
| {{noitalic|About <code><nowiki>{{#titleparts:|}}, {{#expr:|}}, {{#ifeq:|}}, </nowiki></code> etc. | | {{noitalic|About <code><nowiki>{{#titleparts:|}}, {{#expr:|}}, {{#ifeq:|}}, </nowiki></code> etc. | ||
}} }} | |||
<!---- | <!---- | ||
| group12 = Feature requests | | group12 = Feature requests | ||
Строка 115: | Строка 104: | ||
* [[bugzilla:6455]] – Set $wgPFEnableStringFunctions = true on WMF wikis | * [[bugzilla:6455]] – Set $wgPFEnableStringFunctions = true on WMF wikis | ||
* [[bugzilla:26092]] – Enable or install string parsing wikimarkup functionality on WMF wikis | * [[bugzilla:26092]] – Enable or install string parsing wikimarkup functionality on WMF wikis | ||
--> | |||
| класс_внизу = hlist | |||
| внизу = | |||
| | |||
| | |||
<includeonly>{{#ifeq: {{SUBPAGENAME}} | doc || [[Категория:Шаблоны:Работа со строками]] }}</includeonly>{{Nobr*|[[m:Category:String templates]]}} | <includeonly>{{#ifeq: {{SUBPAGENAME}} | doc || [[Категория:Шаблоны:Работа со строками]] }}</includeonly>{{Nobr*|[[m:Category:String templates]]}} | ||
{{Nobr*|[[:commons:Category:String manipulation templates]]}} | {{Nobr*|[[:commons:Category:String manipulation templates]]}} |