|
|
Строка 1: |
Строка 1: |
| {{Navbox with collapsible groups (beta) | | {{docpage}} |
| | name = String-handling templates
| | Шаблон {{t}} предназначен для создания символической записи имён шаблонов на страницах документации в качестве альтернативы шаблону {{tl|tl}}, предназначенному для ''ссылок''. |
| | state = {{{state|uncollapsed}}}
| |
| | bodyclass =
| |
| | title = Шаблоны обработки строк (String-handling templates)
| |
| | selected = {{{selected|{{{expanded|{{{1|}}}}}}}}}
| |
| | abbr1 =
| |
| | sect1 = [[Trimming (computer programming)|Обрезка строки]]
| |
| | list1 =
| |
| {{Navbox (beta) |child
| |
| | group1 = By counting
| |
| | list1 = {{Aligned table |style=padding-right:0.5em;
| |
| |col1style=width:12em; text-align:right;white-space:nowrap;padding-right:0.5em;
| |
| |col2style=font-style:italic;
| |
| | {{tlx|str mid|строка|N|L}}| Возвращает подстроку длиной L, начиная с позиции N. <br /><code><nowiki>{{str mid|строка|3|2}}</nowiki></code> → {{str mid|строка|3|2}}
| |
|
| |
|
| | {{tlx|trunc|строка|N}}| Возвращает заданное количество символов с начала строки.<br /> <code><nowiki>{{trunc|строка|3}}</nowiki></code> → {{trunc|строка|3}}
| | Шаблон можно использовать без параметров — тогда он выведет название текущей страницы, опустив первую букву. Если использовать его с параметром, то, если он помещён на страницу, отличную от заданной в параметре, он произведёт ссылку (то есть поведёт себя, как шаблон {{tl|tl}}). |
|
| |
|
| | {{tlx|str left|строка|N}}| Возвращает заданное количество символов с начала строки.<br /> <code><nowiki>{{str left|строка|3}}</nowiki></code> → {{str left|строка|3}}
| | == Примеры == |
| | * <code><nowiki>{{t}}</nowiki></code> → {{t}} |
| | * <code><nowiki>{{t|t}}</nowiki></code> → {{t|t}} |
| | * <code><nowiki>{{t|tl}}</nowiki></code> → {{t|tl}} |
|
| |
|
| | {{tlx|str crop|строка|N}}| Удаляет справа из строки заданное количество символов.<br /> <code><nowiki>{{str crop|строка|1}}</nowiki></code> → {{str crop|строка|1}}
| | == См. также == |
| | | * {{tl|tp}} — то же самое с параметрами |
| | {{tlx|chop head and tail|строка|N}}| Удаляет с обеих сторон указанное число символов.<br /> <code><nowiki>{{Chop head and tail|строка|2}}</nowiki></code> → {{Chop head and tail|строка|2}}
| |
| | |
| | {{tlx|str right|строка|N}} | Возвращает символы начиная с N и до конца строки.<br /> <code><nowiki>{{Str right|строка|2}}</nowiki></code> → {{Str right|строка|2}}
| |
| | |
| | {{tlx|str rightc|строка|N}} | Возвращает правую часть строки из заданного количества символов. Результат как в {{tl|str rightmost}}.
| |
| | |
| | {{tlx|str rightmost|строка|N}} | <code><nowiki>{{Str rightmost|строка|3}}</nowiki></code> → {{Str rightmost|строка|3}}
| |
| | |
| | {{tlx|str sub old|строка|N|L}} | Удаляет слева N символов и оставляет L. <br /><code><nowiki>{{str sub old|строка|2|3}}</nowiki></code> → {{str sub old|строка|2|3}}
| |
| | |
| | {{tlx|str sub new|строка|N|L}} | Выборает подстроку из строки на основе выбранных индексов.<br /><code><nowiki>{{str sub new|строка|3|5}}</nowiki></code> → {{str sub new|строка|3|5}}
| |
| | |
| | {{tlx|str index|строка|N}} | Возвращает из строки один символ под заданным номером N. <br /> <code><nowiki>{{str index|строка|4}}</nowiki></code> → {{str index|строка|4}}
| |
| | |
| }}
| |
| | |
| | group2 = By checking
| |
| | list2 =
| |
| {{Aligned table |style=padding-right:0.5em;
| |
| |col1style=width:12em; text-align:right; white-space:nowrap; padding-right:0.5em;
| |
| |col2style=font-style:italic;
| |
| | {{tl|trim}} | Удаляет пробелы справа и слева.
| |
| | {{tl|str letter/trim}} | To trim down to the beginning letters.
| |
| | {{tl|str number/trim}} | To trim down to the beginning numbers.
| |
| | {{tl|trim brackets}} | To trim any leading or trailing square brackets.
| |
| | {{tl|first word}} | To trim down to the first space.
| |
| | {{tl|remove first word}} | To remove anything before the first space.
| |
| | {{tl|last word}} | To trim down from the last space.
| |
| | {{tl|remove last word}} | To remove anything after the last space.
| |
| }}
| |
| | |
| | group3 = Dedicated
| |
| | list3 =
| |
| {{Aligned table |style=padding-right:0.5em;
| |
| |col1style=width:12em; text-align:right;white-space:nowrap;padding-right:0.5em;
| |
| |col2style=font-style:italic;
| |
| | {{tl|delink}} | Removes wikilink brackets (wikicode).
| |
| | {{tl|remove file prefix}} | Removes "File:" (or "Image:") from filenames.
| |
| | {{tl|PAGENAMEBASE}} | To trim off any parenthesis text at the end of a string (disambiguation).
| |
| | {{tl|title disambig text}} | Returns text in parenthesis at the end of a string (disambiguation).
| |
| | {{tl|WikiProjectbasename}} | Removes "WikiProject" from a pagename.
| |
| | {{tl|remove unranked}} | Removes the string "unranked_" from the left of a string (taxonomy).
| |
| | {{tl|ship prefix}} | Returns the length of a ship's name prefix, if listed (ship names).
| |
| | {{tl|title year}} | Returns the 4-digit year from a pagename, if any.
| |
| }} }}
| |
| | |
| | abbr2 =
| |
| | sect2 =
| |
| | list2 =
| |
| | group4 = Вставка и замена строк
| |
| | list4 =
| |
| {{Aligned table |style=padding-right:0.5em;
| |
| |col1style=width:9em; text-align:right; white-space:nowrap; padding-right:0.5em; background:#F6F6F6;
| |
| |col2style=text-align:left;font-style:italic;
| |
| | {{tl|strloc insert}} | Inserts a string at character location strloc, or appends if strloc<{{=}}0.
| |
| | {{tl|loop}} | Repeat character string a specified number of times.
| |
| | {{tl|repeat}} | Repeat a string a specified number of times.
| |
| | {{tl|replace}} | Returns the string, after replacing ''all'' occurrences of a specified string with another string.
| |
| | {{tl|str rep}} | Returns the string, after replacing the first occurrence of a specified string with another string.
| |
| | {{tlx|str len|строка}} | Возвращает длину строки. <code><nowiki>{{Str len|строка}}</nowiki></code> → {{Str len|строка}}
| |
| |{{tl|iflenge}} | [if len]gth [g]reater than or [e]qual to.
| |
| |{{tl|str ≥ len}} | To check if a string is "longer or equally long" or "shorter" than a given length.
| |
| |{{tl|str ≤ len}} | To check if a string is "shorter or equally long" or "longer" than a given length.
| |
| |{{tl|str ≠ len}} | To check if a string is "not equal" or "equal" to a given length.
| |
| |{{tl|str ≤ ≥ len}} | To check if a string is "shorter", "equal", or "longer" than a given length.
| |
| }}
| |
| | |
| | abbr3 =
| |
| | sect3 =
| |
| | list3 =
| |
| | group5 = Analysis and technical
| |
| | list5 =
| |
| {{Aligned table |style=margin:0 auto 0; text-align:left;
| |
| |col1style=width:9em; text-align:right; white-space:nowrap; padding-right:0.5em; background:#F6F6F6;
| |
| |col2style= font-style:italic;
| |
| | {{tl|str endswith}} | To check if a string ends with a given string.
| |
| | {{tl|str find}}<br />{{tl|strfind short}}
| |
| |Returns the numerical location of a given string in a string.
| |
| | {{tl|str find0}} | Zero-based substring search.
| |
| | {{tl|str sub find}} | Searches a substring in a string at the given offset.
| |
| | {{tl|str letter}} | Returns the number of letters that begin a string.
| |
| | {{tl|str number}} | Returns the number of numbers that begin a string.
| |
| | {{tl|str gtr str}} | Compares two strings for alphabetical order, and returns a value accordingly.
| |
| | {{tl|ASCII code}} | Returns the ASCII value of a single character.
| |
| | {{tl|a or an}} | Takes a noun and produces the appropriate indefinite article, based on whether the first letter is a vowel.
| |
| | |
| |
| | [[Module:String]] |
| |
| | [[mw:Help:Magic words|...Magic words]]
| |
| | {{noitalic|About <code><nowiki>{{padleft:|}}</nowiki></code>.}}
| |
| | [[mw:Help:Extension:ParserFunctions|...ParserFunctions]]
| |
| | {{noitalic|About <code><nowiki>{{#titleparts:|}}, {{#expr:|}}, {{#ifeq:|}}, </nowiki></code> etc.
| |
| }} }}
| |
| | |
| <!----
| |
| | group12 = Feature requests
| |
| | list12 =
| |
| * [[bugzilla:6455]] – Set $wgPFEnableStringFunctions = true on WMF wikis
| |
| * [[bugzilla:26092]] – Enable or install string parsing wikimarkup functionality on WMF wikis
| |
| | |
| <!----Not in a navbox:
| |
| | group13 = [[Wikipedia:Template sandbox and test cases|Sandboxes, testcases]]
| |
| | list13 =
| |
| * {{tl|Str find/sandbox}} | |
| * {{tl|Str index/getchar/sandbox}}
| |
| * {{tl|Str index/getchar/testcases}}
| |
| * {{tl|Str index/sandbox}}
| |
| * {{tl|Str index/testcases}}
| |
| * {{tl|Str index any/sandbox}}
| |
| * {{tl|Str index any/testcases}}
| |
| * {{tl|Str left/sandbox}}
| |
| * {{tl|Str len/core/sandbox}}
| |
| * {{tl|Str len/sandbox}}
| |
| * {{tl|Str len/testcases}}
| |
| * {{tl|Str rightc/testcases}}
| |
| * {{tl|Str ≠ len/sandbox}}
| |
| * {{tl|Str ≠ len/testcases}}
| |
| ----->
| |
| | |
| | belowclass = hlist
| |
| | below ={{Nobr*|[[:Category:String manipulation templates]]}} {{Nobr*| [[m:Category:String templates]]}} {{Nobr*|[[:commons:Category:String manipulation templates]]}}
| |
| | tracking = no
| |
| }}<noinclude>{{Doc}}</noinclude>
| |