Qore Programming Language Reference Manual  1.0.8
ql_string.dox.h
1 
3 namespace Qore {
191 
193 
221 int bindex(softstring str, softstring substr, softint pos = 0);
222 
224 
228 int bindex();
229 
231 
258 int brindex(softstring str, softstring substr, softint pos = -1);
259 
261 
265 int brindex();
266 
268 
291 int char_width(softstring str);
292 
294 
310 string chomp(string str);
311 
313 
324 *string chomp(reference<string> str);
325 
327 
331 nothing chomp();
332 
334 
349 string chr(softint val, *string encoding);
350 
352 
357 string chr(auto arg);
358 
360 
364 nothing chr();
365 
367 
382 string convert_encoding(string str, string encoding);
383 
385 
389 nothing convert_encoding();
390 
392 
411 string f_printf(string fmt, ...);
412 
414 
418 string f_printf();
419 
421 
440 string f_sprintf(string fmt, ...);
441 
443 
447 string f_sprintf();
448 
450 
471 string f_vprintf(string fmt, auto varg);
472 
474 
495 string f_vsprintf(string fmt, auto varg);
496 
498 
506 nothing flush();
507 
509 
524 string force_encoding(string str, string encoding);
525 
527 
531 nothing force_encoding();
532 
534 
553 string format_number(string fmt, softfloat num);
554 
556 
560 nothing format_number();
561 
563 
577 string get_encoding(string str);
578 
580 
584 nothing get_encoding();
585 
587 
616 int index(softstring str, softstring substr, softint pos = 0);
617 
619 
623 int index();
624 
626 
641 string join(string str, ...);
642 
644 
661 string join(string str, list<auto> l);
662 
664 
668 nothing join();
669 
671 
694 int length(softstring str);
695 
697 
711 int length(binary bin);
712 
714 
718 nothing length();
719 
721 
725 int length(auto arg);
726 
728 
744 string ltrim(string str, *string chars);
745 
747 
761 *string ltrim(reference<string> str, *string chars);
762 
764 
779 int ord(softstring str, softint offset = 0);
780 
782 
786 int ord();
787 
789 
803 bool parse_boolean(string str);
804 
806 
818 bool parse_boolean(any val);
819 
821 
840 float parse_float(string str, string fmt);
841 
843 
862 int parse_int(string str, string fmt);
863 
865 
884 number parse_number(string str, string fmt);
885 
887 
899 nothing print( ...);
900 
902 
921 string printf(string fmt, ...);
922 
924 
931 string printf();
932 
934 
958 bool regex(string str, string regex, int options = 0);
959 
961 
965 nothing regex();
966 
968 
994 *list<*string> regex_extract(string str, string regex, int options = 0);
995 
997 
1001 nothing regex_extract();
1002 
1004 
1043 string regex_subst(string str, string regex, string subst, int options = 0);
1044 
1046 
1050 nothing regex_subst();
1051 
1053 
1081 string replace(string str, string source, string target, int start = 0, int end = -1);
1082 
1084 
1088 nothing replace();
1089 
1091 
1107 string reverse(softstring str);
1108 
1110 
1139 int rindex(softstring str, softstring substr, softint pos = -1);
1140 
1142 
1146 int rindex();
1147 
1149 
1167 string rtrim(string str, *string chars);
1168 
1170 
1186 *string rtrim(reference<string> str, *string chars);
1187 
1189 
1207 list<string> split(string sep, string str, bool with_separator = False);
1208 
1210 
1245 list<string> split(string sep, string str, string quote, bool trim_unquoted = False);
1246 
1248 
1263 list<binary> split(data sep, binary data);
1264 
1266 
1270 list<string> split();
1271 
1273 
1292 string sprintf(string fmt, ...);
1293 
1295 
1299 string sprintf();
1300 
1302 
1322 int strlen(softstring str);
1323 
1325 
1329 nothing strlen();
1330 
1332 
1336 int strlen(auto arg);
1337 
1339 
1353 string strmul(softstring str, softint smul, *softint offset);
1354 
1356 
1376 string substr(softstring str, softint start);
1377 
1379 
1400 string substr(softstring str, softint start, softint len);
1401 
1403 
1423 binary substr(binary b, softint start);
1424 
1426 
1447 binary substr(binary b, softint start, softint len);
1448 
1450 
1454 nothing substr();
1455 
1457 
1481 string tolower(string str);
1482 
1484 
1488 nothing tolower();
1489 
1491 
1515 string toupper(string str);
1516 
1518 
1522 nothing toupper();
1523 
1525 
1540 string trim(string str, *string chars);
1541 
1543 
1557 *string trim(reference<string> str, *string chars);
1558 
1560 
1564 nothing trim();
1565 
1567 
1583 string trunc_str(softstring str, softint len, *string encoding);
1584 
1586 
1605 string vprintf(string fmt, auto varg);
1606 
1608 
1612 string vprintf();
1613 
1615 
1634 string vsprintf(string fmt, auto varg);
1635 
1637 
1641 string vsprintf();
1642 
1644 }
1645 
1647 namespace Qore {
1652 
1654  const RE_Caseless = PCRE_CASELESS;
1657  const RE_DotAll = PCRE_DOTALL;
1659  const RE_Extended = PCRE_EXTENDED;
1661  const RE_Global = QRE_GLOBAL;
1663  const RE_MultiLine = PCRE_MULTILINE;
1665 
1667  const RE_Unicode = PCRE_UCP;
1669 }
string sprintf(string fmt,...)
Returns a formatted string based on a format string and other arguments; does not enforce field width...
string printf(string fmt,...)
Outputs the string passed to standard output, using the first argument as a format string; does not e...
const RE_Unicode
extens Posix matches to the full Unicode character set
Definition: ql_string.dox.h:1667
string force_encoding(string str, string encoding)
Returns the first string argument tagged with the character encoding given as the second argument; do...
int strlen(softstring str)
Returns the length in bytes of the string argument.
string rtrim(string str, *string chars)
Removes byte characters from the end of a string and returns the new string.
bool parse_boolean(string str)
tries to parse a string value as a boolean
string get_encoding(string str)
Returns a string describing the character encoding of the string argument passed. ...
string format_number(string fmt, softfloat num)
Returns a string of a formatted number according to a number argument and a format string...
number parse_number(string str, string fmt)
returns a number corresponding to the string and the argument, giving the format
int bindex(softstring str, softstring substr, softint pos=0)
Retrieves the byte position of a substring within a string.
string trim(string str, *string chars)
Removes byte characters from the start and end of a string and returns the new string (also see the t...
nothing flush()
Flushes output to the console output with print(), printf(), etc.
number number(softnumber n)
Converts the argument to a number value.
const RE_MultiLine
makes start-of-line (^) or end-of-line ($) match after or before any newline in the subject string...
Definition: ql_string.dox.h:1663
binary binary()
Always returns an empty binary object (of zero length)
string substr(softstring str, softint start)
Returns a portion of a string starting from an integer offset.
string f_vprintf(string fmt, auto varg)
Outputs the string passed to standard output, using the first argument as a format string and a secon...
string chomp(string str)
Removes the trailing end-of-line indicator ("\n" or "\r\n") from a string and returns the new string ...
const False
logical False
Definition: qc_qore.dox.h:96
nothing print(...)
Outputs a string to standard output with no formatting.
string replace(string str, string source, string target, int start=0, int end=-1)
Replaces all occurrences of a substring in a string with another string.
*list< *string > regex_extract(string str, string regex, int options=0)
Returns a list of substrings in a string based on matching patterns defined by a regular expression...
int index(softstring str, softstring substr, softint pos=0)
Retrieves the character position of a substring within a string.
list< string > split(string sep, string str, bool with_separator=False)
Splits a string into a list of components based on a separator string.
const RE_Caseless
Ignores case when matching regular expressions, equivalent to /i
Definition: ql_string.dox.h:1655
bool regex(string str, string regex, int options=0)
Returns True if the regular expression matches the string passed, otherwise returns False...
string vprintf(string fmt, auto varg)
Outputs the string passed to standard output, using the first argument as a format string and a secon...
const RE_DotAll
makes a dot (.) match a newline character, equivalent to /s
Definition: ql_string.dox.h:1657
string strmul(softstring str, softint smul, *softint offset)
Returns a new string with a repeated string element and optionally removing trailing characters...
string chr(softint val, *string encoding)
Returns a string containing a single ASCII character represented by the numeric value passed...
string convert_encoding(string str, string encoding)
Performs explicit string character encoding conversions.
int char_width(softstring str)
Returns the width of characters in the string; some unicode characters take up multiple spaces on out...
const RE_Global
replace all matches globally in the string or extract all occurrences of the pattern(s) in the string...
Definition: ql_string.dox.h:1661
string tolower(string str)
Returns a string in all lower-case characters based on the argument passed.
string toupper(string str)
Returns a string in all upper-case characters based on the argument passed.
string vsprintf(string fmt, auto varg)
Returns a formatted string based on a format string and other arguments given as a list after the for...
int ord(softstring str, softint offset=0)
Gives the positive numeric value of the given byte in the string passed; if no string is passed or th...
string f_vsprintf(string fmt, auto varg)
Returns a formatted string based on a format string and other arguments given as a list after the for...
string regex_subst(string str, string regex, string subst, int options=0)
Returns a string with patterns substituted according to the arguments passed.
int rindex(softstring str, softstring substr, softint pos=-1)
Retrieves the character position of a substring within a string, starting the search from the end of ...
string f_sprintf(string fmt,...)
Returns a formatted string based on a format string and other arguments; enforces field widths on arg...
float parse_float(string str, string fmt)
returns a floating-point value corresponding to a string representing the number and an argument givi...
int parse_int(string str, string fmt)
returns an integer corresponding to a string representing the number and an argument giving the forma...
string trunc_str(softstring str, softint len, *string encoding)
Returns a truncated string with no more than the given number of bytes and optionally converted to a ...
const RE_Extended
ignores whitespace characters and enables comments prefixed by #, equivalent to /x ...
Definition: ql_string.dox.h:1659
int brindex(softstring str, softstring substr, softint pos=-1)
Retrieves the byte position of a substring within a string, starting the search from the end of the s...
int length(softstring str)
Returns the length in characters for the string passed.
string ltrim(string str, *string chars)
Removes byte characters from the start of a string and returns the new string.
main Qore-language namespace
Definition: Pseudo_QC_All.dox.h:3
string join(string str,...)
Creates a string from separator string and a list of arguments.
nothing reverse()
This function variant does nothing at all; it is only included for backwards-compatibility with qore ...
string f_printf(string fmt,...)
Outputs the string passed to standard output, using the first argument as a format string; enforces f...