Вверх ↑
Пакеты 
Кодогенерация 
RTCG 
Функции - Работа со строками

Работа со строками
Описание
Представляет функции для работы со строковыми данными.

Функции


string lower(<value>)
Приводит строку к нижнему регистру.

Return: новая строка




string upper(<value>)
Приводит строку к верхнему регистру.

Return: новая строка




int len(<value>)
Определяет длинну строки.

Return: длинна строки




int pos(<source>, <target>, <start>)
Ищет позицию подстроки <target> в строке <source> начиная с позиции <start>.

Return: позиция первого вхождения подстроки в строку или -1 в случае отсутствия




int rpos(<source>, <target>, <start>)
Ищет позицию подстроки <target> в строке <source> начиная с позиции <start> с конца строки.

Return: позиция первого вхождения подстроки в строку или -1 в случае отсутствия




string copy(<source>, <start>[, <length>])
Копирует заданное количество символов начиная с указанной позиции.

Return: новая строка




string strcat(<target>, <source>)
Выполняет конкатенацию строк

Return: новая строка




array split(<source>, <delimiter>)
Преобразует строку в массив, используя указанный разделитель

Return: массив строк




string replace(<value>, <target>, <source>)
Заменяет в строке <value> все вхождения подстроки <target> строкой <source>.

Return: новая строка




string delete(<source>, <start>, <length>)
Удаляет заданное количество символов начиная с указанной позиции.

Return: новая строка




string unescape(<source>)
Заменяет двойные символы backslash одинарными в заданной строке.

Return: Новую строку




string escape(<source>)
Заменяет одинарные символы backslash двойными в заданной строке.

Return: Новую строку




array regex_search(<source>, <expression>[,<flags>])
Выполняет поиск регулярных выражений в заданной строке.

Return: массив строк с результатами поиска




string regex_replace(<source>, <expression>, <format>[,<flags>])
Выполняет поиск регулярных выражений в заданной строке и замену их указанной строкой.

Return: новая строка

Description flag values
The type match_flag_type is an implementation specific bitmask type (see C++ std 17.3.2.1.2). When matching a regular expression against a sequence of characters [first, last) then setting its elements has the effects listed in the table below:
FlagEffect if set
match_default Specifies that matching of regular expressions proceeds without any modification of the normal rules used in ECMA-262, ECMAScript Language Specification, Chapter 15 part 10, RegExp (Regular Expression) Objects (FWD.1)
match_not_bob Specifies that the expressions "\A" and "\`" should not match against the sub-sequence [first,first).
match_not_eob Specifies that the expressions "\'", "\z" and "\Z" should not match against the sub-sequence [last,last).
match_not_bol Specifies that the expression "^" should not be matched against the sub-sequence [first,first).
match_not_eol Specifies that the expression "$" should not be matched against the sub-sequence [last,last).
match_not_bow Specifies that the expressions "\<" and "\b" should not be matched against the sub-sequence [first,first).
match_not_eow Specifies that the expressions "\>" and "\b" should not be matched against the sub-sequence [last,last).
match_any Specifies that if more than one match is possible then any match is an acceptable result: this will still find the leftmost match, but may not find the "best" match at that position. Use this flag if you care about the speed of matching, but don't care what was matched (only whether there is one or not).
match_not_null Specifies that the expression can not be matched against an empty sequence.
match_continuous Specifies that the expression must match a sub-sequence that begins at first.
match_partial Specifies that if no match can be found, then it is acceptable to return a match [from, last) such that from!= last, if there could exist some longer sequence of characters [from,to) of which [from,last) is a prefix, and which would result in a full match. This flag is used when matching incomplete or very long texts, see the partial matches documentation for more information.
match_extra Instructs the matching engine to retain all available capture information; if a capturing group is repeated then information about every repeat is available via match_results::captures() or sub_match_captures().
match_single_line Equivalent to the inverse of Perl's m/ modifier; prevents ^ from matching after an embedded newline character (so that it only matches at the start of the text being matched), and $ from matching before an embedded newline (so that it only matches at the end of the text being matched).
match_prev_avail Specifies that --first is a valid iterator position, when this flag is set then the flags match_not_bol and match_not_bow are ignored by the regular expression algorithms (RE.7) and iterators (RE.8).
match_not_dot_newline Specifies that the expression "." does not match a newline character. This is the inverse of Perl's s/ modifier.
match_not_dot_null Specifies that the expression "." does not match a character null '\0'.
match_posix Specifies that the expression should be matched according to the POSIX leftmost-longest rule, regardless of what kind of expression was compiled. Be warned that these rules do not work well with many Perl-specific features such as non-greedy repeats.
match_perl Specifies that the expression should be matched according to the Perl matching rules, irrespective of what kind of expression was compiled.
match_nosubs Makes the expression behave as if it had no marked subexpressions, no matter how many capturing groups are actually present. The match_results class will only contain information about the overall match, and not any sub-expressions.
format_default Specifies that when a regular expression match is to be replaced by a new string, that the new string is constructed using the rules used by the ECMAScript replace function in ECMA-262, ECMAScript Language Specification, Chapter 15 part 5.4.11 String.prototype.replace. (FWD.1). This is functionally identical to the Perl format string rules. In addition during search and replace operations then all non-overlapping occurrences of the regular expression are located and replaced, and sections of the input that did not match the expression, are copied unchanged to the output string.
format_sed Specifies that when a regular expression match is to be replaced by a new string, that the new string is constructed using the rules used by the Unix sed utility in IEEE Std 1003.1-2001, Portable Operating SystemInterface (POSIX ), Shells and Utilities. See also the Sed Format string reference.
format_perl Specifies that when a regular expression match is to be replaced by a new string, that the new string is constructed using the same rules as Perl 5.
format_all Specifies that all syntax extensions are enabled, including conditional (?ddexpression1:expression2) replacements: see the format string guide for more details.
format_no_copy When specified during a search and replace operation, then sections of the character container sequence being searched that do match the regular expression, are not copied to the output string.
format_first_only When specified during a search and replace operation, then only the first occurrence of the regular expression is replaced.





BB-code статьи для вставки
Всего комментариев: 0
(комментарии к статье еще не добавлены)
Комментарий
...