$darkmode
Qore Programming Language Reference Manual 1.18.0
ql_string.dox.h
1
3namespace Qore {
192
194
221int bindex(softstring str, softstring substr, softint pos = 0);
222
224
228int bindex();
229
231
258int brindex(softstring str, softstring substr, softint pos = -1);
259
261
266
268
291int char_width(softstring str);
292
294
310string chomp(string str);
311
313
324*string chomp(reference<string> str);
325
327
331nothing chomp();
332
334
349string chr(softint val, *string encoding);
350
352
357string chr(auto arg);
358
360
364nothing chr();
365
367
382string convert_encoding(string str, string encoding);
383
385
390
392
411string f_printf(string fmt, ...);
412
414
418string f_printf();
419
421
440string f_sprintf(string fmt, ...);
441
443
447string f_sprintf();
448
450
471string f_vprintf(string fmt, auto varg);
472
474
495string f_vsprintf(string fmt, auto varg);
496
498
506nothing flush();
507
509
524string force_encoding(string str, string encoding);
525
527
532
534
553string format_number(string fmt, softfloat num);
554
556
561
563
577string get_encoding(string str);
578
580
584nothing get_encoding();
585
587
616int index(softstring str, softstring substr, softint pos = 0);
617
619
623int index();
624
626
641string join(string str, ...);
642
644
661string join(string str, list<auto> l);
662
664
668nothing join();
669
671
694int length(softstring str);
695
697
711int length(binary bin);
712
714
718nothing length();
719
721
725int length(auto arg);
726
728
744string ltrim(string str, *string chars);
745
747
761*string ltrim(reference<string> str, *string chars);
762
764
779int ord(softstring str, softint offset = 0);
780
782
786int ord();
787
789
803bool parse_boolean(string str);
804
806
818bool parse_boolean(any val);
819
821
840float parse_float(string str, string fmt);
841
843
862int parse_int(string str, string fmt);
863
865
884number parse_number(string str, string fmt);
885
887
899nothing print( ...);
900
902
921string printf(string fmt, ...);
922
924
931string printf();
932
934
958bool regex(string str, string regex, int options = 0);
959
961
965nothing regex();
966
968
994*list<*string> regex_extract(string str, string regex, int options = 0);
995
997
1002
1004
1043string regex_subst(string str, string regex, string subst, int options = 0);
1044
1046
1050nothing regex_subst();
1051
1053
1081string replace(string str, string source, string target, int start = 0, int end = -1);
1082
1084
1088nothing replace();
1089
1091
1107string reverse(softstring str);
1108
1110
1139int rindex(softstring str, softstring substr, softint pos = -1);
1140
1142
1147
1149
1167string rtrim(string str, *string chars);
1168
1170
1186*string rtrim(reference<string> str, *string chars);
1187
1189
1213list<string> split(string sep, string str, bool with_separator = False);
1214
1216
1251list<string> split(string sep, string str, string quote, bool trim_unquoted = False);
1252
1254
1269list<binary> split(data sep, binary data);
1270
1272
1276list<string> split();
1277
1279
1298string sprintf(string fmt, ...);
1299
1301
1305string sprintf();
1306
1308
1328int strlen(softstring str);
1329
1331
1335nothing strlen();
1336
1338
1342int strlen(auto arg);
1343
1345
1359string strmul(softstring str, softint smul, *softint offset);
1360
1362
1382string substr(softstring str, softint start);
1383
1385
1406string substr(softstring str, softint start, softint len);
1407
1409
1429binary substr(binary b, softint start);
1430
1432
1453binary substr(binary b, softint start, softint len);
1454
1456
1460nothing substr();
1461
1463
1487string tolower(string str);
1488
1490
1494nothing tolower();
1495
1497
1521string toupper(string str);
1522
1524
1528nothing toupper();
1529
1531
1546string trim(string str, *string chars);
1547
1549
1563*string trim(reference<string> str, *string chars);
1564
1566
1570nothing trim();
1571
1573
1589string trunc_str(softstring str, softint len, *string encoding);
1590
1592
1611string vprintf(string fmt, auto varg);
1612
1614
1618string vprintf();
1619
1621
1640string vsprintf(string fmt, auto varg);
1641
1643
1647string vsprintf();
1648
1650}
1651
1653namespace Qore {
1659
1661 const RE_Caseless = PCRE_CASELESS;
1663 const RE_DotAll = PCRE_DOTALL;
1665 const RE_Extended = PCRE_EXTENDED;
1667 const RE_Global = QRE_GLOBAL;
1669 const RE_MultiLine = PCRE_MULTILINE;
1671
1673 const RE_Unicode = PCRE_UCP;
1675}
const False
logical False
Definition: qc_qore.dox.h:96
nothing reverse()
This function variant does nothing at all.
const RE_DotAll
makes a dot (.) match a newline character, equivalent to /s
Definition: ql_string.dox.h:1663
const RE_Unicode
extens Posix matches to the full Unicode character set
Definition: ql_string.dox.h:1673
const RE_Extended
ignores whitespace characters and enables comments prefixed by #, equivalent to /x
Definition: ql_string.dox.h:1665
const RE_Caseless
Ignores case when matching regular expressions, equivalent to /i
Definition: ql_string.dox.h:1661
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:1669
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:1667
number parse_number(string str, string fmt)
returns a number corresponding to the string and the argument, giving the format
string convert_encoding(string str, string encoding)
Performs explicit string character encoding conversions.
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...
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...
int bindex(softstring str, softstring substr, softint pos=0)
Retrieves the byte position of a substring within a string.
string join(string str,...)
Creates a string from separator string and a list of arguments.
string rtrim(string str, *string chars)
Removes byte characters from the end of a string and returns the new string.
string printf(string fmt,...)
Outputs the string passed to standard output, using the first argument as a format string; does not e...
string format_number(string fmt, softfloat num)
Returns a string of a formatted number according to a number argument and a format string.
int char_width(softstring str)
Returns the width of characters in the string; some unicode characters take up multiple spaces on out...
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 ...
string f_printf(string fmt,...)
Outputs the string passed to standard output, using the first argument as a format string; enforces f...
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 toupper(string str)
Returns a string in all upper-case characters based on the argument 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 ...
nothing flush()
Flushes output to the console output with print(), printf(), etc.
int length(softstring str)
Returns the length in characters for the string passed.
string tolower(string str)
Returns a string in all lower-case characters based on the argument passed.
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.
bool parse_boolean(string str)
tries to parse a string value as a boolean
bool regex(string str, string regex, int options=0)
Returns True if the regular expression matches the string passed, otherwise returns False.
string sprintf(string fmt,...)
Returns a formatted string based on a format string and other arguments; does not enforce field width...
string chomp(string str)
Removes the trailing end-of-line indicator ("\n" or "\r\n") from a string and returns the new string ...
string f_sprintf(string fmt,...)
Returns a formatted string based on a format string and other arguments; enforces field widths on arg...
string vprintf(string fmt, auto varg)
Outputs the string passed to standard output, using the first argument as a format string and a secon...
nothing print(...)
Outputs a string to standard output with no formatting.
string ltrim(string str, *string chars)
Removes byte characters from the start of a string and returns the new string.
string strmul(softstring str, softint smul, *softint offset)
Returns a new string with a repeated string element and optionally removing trailing characters.
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 vsprintf(string fmt, auto varg)
Returns a formatted string based on a format string and other arguments given as a list after the for...
*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.
string get_encoding(string str)
Returns a string describing the character encoding of the string argument passed.
int parse_int(string str, string fmt)
returns an integer corresponding to a string representing the number and an argument giving the forma...
list< string > split(string sep, string str, bool with_separator=False)
Splits a string into a list of components based on a separator string.
float parse_float(string str, string fmt)
returns a floating-point value corresponding to a string representing the number and an argument givi...
string chr(softint val, *string encoding)
Returns a string containing a single ASCII character represented by the numeric value passed.
string regex_subst(string str, string regex, string subst, int options=0)
Returns a string with patterns substituted according to the arguments passed.
int index(softstring str, softstring substr, softint pos=0)
Retrieves the character position of a substring within a string.
string force_encoding(string str, string encoding)
Returns the first string argument tagged with the character encoding given as the second argument; do...
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...
int strlen(softstring str)
Returns the length in bytes of the string argument.
string substr(softstring str, softint start)
Returns a portion of a string starting from an integer offset.
binary binary()
Always returns an empty binary object (of zero length)
number number(softnumber n)
Converts the argument to a number value.
main Qore-language namespace
Definition: Pseudo_QC_All.dox.h:3