All Classes Namespaces Functions Variables Groups Pages
Miscellaneous Functions

## Functions

string | Qore::backquote (string cmd)
| Executes a process and returns a string of the output (stdout only)
nothing | Qore::backquote ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.
any | Qore::call_builtin_function (string name,...)
| Calls a function and returns the return value, passing the remaining arguments after the function name to the builtin function.
any | Qore::call_builtin_function_args (string name, *softlist vargs)
| Calls a function and returns the return value, using the optional second argument as a list of arguments for the function.
any | Qore::call_function (string name,...)
| Calls a function and returns the return value, passing the remaining arguments after the function name to the function.
any | Qore::call_function (code f,...)
| Calls the given call reference or closure and returns the result, passing the remaining arguments to the call reference or closure.
any | Qore::call_function_args (string name, *softlist vargs)
| Calls a function and returns the return value, using the optional second argument as a list of arguments for the function.
any | Qore::call_function_args (code f, *softlist vargs)
| Calls the given call reference or closure and returns the result, using the optional second argument as a list of arguments to the call reference or closure.
string | Qore::decode_url (string url)
| Decodes percent numeric codes in a URL string and returns the decoded string.
nothing | Qore::decode_url ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.
bool | Qore::exists (...)
| A function performing the same role as the exists operator.
bool | Qore::existsFunction (string name)
| Returns True if the function exists in the current program's function name space.
bool | Qore::existsFunction (code c)
| Always returns True.
nothing | Qore::existsFunction ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.
*string | Qore::functionType (string name)
| Returns `"builtin"` (for a builtin function), `"user"` (for a user function), or NOTHING (if the function cannot be found) according to the function name passed.
nothing | Qore::functionType ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.
*int | Qore::getByte (string str, softint offset=0)
| Returns the byte value at the given byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.
nothing | Qore::getByte ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.
*int | Qore::getByte (binary b, softint offset=0)
| Returns the byte value at the given byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.
string | Qore::getClassName (object obj)
| Returns the class name of the object passed.
nothing | Qore::getClassName ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.
list | Qore::getFeatureList ()
| Returns a list of strings of the builtin and module-supplied features of Qore.
hash | Qore::getModuleHash ()
| Returns a hash of hashes describing the currently-loaded Qore modules; the top-level hash keys are the module names.
list | Qore::getModuleList ()
| Returns a list of hashes describing the currently-loaded Qore modules.
*int | Qore::getWord32 (string str, softint offset=0)
| Returns the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.
*int | Qore::getWord32 (binary b, softint offset=0)
| Returns the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.
nothing | Qore::getWord32 ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.
*int | Qore::get_byte (string str, softint offset=0)
| Returns the byte value at the given byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.
*int | Qore::get_byte (binary b, softint offset=0)
| Returns the byte value at the given byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.
string | Qore::get_default_encoding ()
| Returns the name of the default character encoding.
string | Qore::get_ex_pos (hash ex)
| returns a descriptive string for an exception location; the `source` and `offset` information will also be included in the string returned if present in the exception hash argument
int | Qore::get_parse_options ()
| returns the current parse options for the current Program object
hash | Qore::get_qore_library_info ()
| Returns a hash of library build and version info.
hash | Qore::get_qore_option_hash ()
| Returns a hash of hashes giving information about Qore library options for the current build.
list | Qore::get_qore_option_list ()
| Returns a list of hashes giving information about Qore library options for the current build.
*string | Qore::get_script_dir ()
| Returns the name of the directory from which the current script was executed or NOTHING if unknown (i.e. no parent script, script read from stdin, etc)
*string | Qore::get_script_name ()
| Returns the filename of the current script if known or NOTHING if unknown (i.e. no parent script, script read from stdin, etc)
*string | Qore::get_script_path ()
| Returns the path (directory and filename) of the current script or NOTHING if unknown (i.e. no parent script, script read from stdin, etc)
*int | Qore::get_word_16 (string str, softint offset=0)
| Returns the 16-bit integer value at the given 2-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.
*int | Qore::get_word_16 (binary b, softint offset=0)
| Returns the 16-bit integer value at the given 2-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.
*int | Qore::get_word_16_lsb (string str, softint offset=0)
| Returns the 16-bit integer value at the given 2-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.
*int | Qore::get_word_16_lsb (binary b, softint offset=0)
| Returns the 16-bit integer value at the given 2-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.
*int | Qore::get_word_32 (string str, softint offset=0)
| Returns the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.
*int | Qore::get_word_32 (binary b, softint offset=0)
| Returns the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.
*int | Qore::get_word_32_lsb (string str, softint offset=0)
| Returns the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.
*int | Qore::get_word_32_lsb (binary b, softint offset=0)
| Returns the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.
*int | Qore::get_word_64 (string str, softint offset=0)
| Returns the 64-bit integer value at the given 8-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.
*int | Qore::get_word_64 (binary b, softint offset=0)
| Returns the 64-bit integer value at the given 8-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.
*int | Qore::get_word_64_lsb (string str, softint offset=0)
| Returns the 64-bit integer value at the given 8-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.
*int | Qore::get_word_64_lsb (binary b, softint offset=0)
| Returns the 64-bit integer value at the given 8-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.
bool | Qore::has_key (hash h, string key)
| Returns True if the given key exists in the hash (does not necessarily have to have a value assigned); exceptions are only raised if string encoding errors are encountered.
bool | Qore::has_key (object obj, string key)
| Returns True if the given key exists in the object (does not necessarily have to have a value assigned); exceptions are only raised if string encoding errors are encountered or in case of object access errors.
list | Qore::hash_values (hash h)
| Returns a list of all the values in the hash argument passed.
nothing | Qore::hash_values ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.
int | Qore::hextoint (string str)
| Returns an integer for a hexadecimal string value; throws an exception if non-hex digits are found.
nothing | Qore::hextoint ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.
string | Qore::html_decode (string str)
| Returns a string with any HTML escape codes translated to the original characters.
nothing | Qore::html_decode ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.
string | Qore::html_encode (string str)
| Returns a string with characters needing HTML escaping translated to HTML escape codes.
nothing | Qore::html_encode ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.
nothing | Qore::load_module (string name)
| Loads in a Qore module at run-time.
nothing | Qore::load_module ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.
string | Qore::makeBase64String (string str, softint maxlinelen=-1)
| Returns a base64-encoded representation of a string.
string | Qore::makeBase64String (binary bin, softint maxlinelen=-1)
| Returns a base64-encoded representation of a binary object.
nothing | Qore::makeBase64String ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.
string | Qore::makeHexString (string str)
| Returns a hex-encoded representation of a string.
string | Qore::makeHexString (binary bin)
| Returns a hex-encoded representation of a binary object.
nothing | Qore::makeHexString ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.
*hash | Qore::parse (string code, string label, *softint warning_mask, *string source, *softint offset, softbool format_label=True)
| Adds the text passed to the current program's code, tagged with the given label.
nothing | Qore::parse ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.
binary | Qore::parseBase64String (string str)
| Parses a base64 encoded string and returns a binary object of the decoded data.
nothing | Qore::parseBase64String ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.
string | Qore::parseBase64StringToString (string str, *string encoding)
| Parses a base64 encoded string and returns a string of the decoded data.
nothing | Qore::parseBase64StringToString ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.
binary | Qore::parseHexString (string hexstr)
| Parses a hex-encoded string and returns the binary object.
nothing | Qore::parseHexString ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.
*hash | Qore::parseURL (string url, bool keep_brackets=False)
| Parses a URL string and returns a hash of the components; if the URL cannot be parsed then NOTHING is returned.
nothing | Qore::parseURL ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.
hash | Qore::parse_url (string url, bool keep_brackets=False)
| Parses a URL string and returns a hash of the components; throws an exception if the string cannot be parsed as a URL.
string | Qore::splice (string str)
| This function always returns an empty string `""`.
string | Qore::splice (string str, softint start)
| Returns a string based on the argument string but with characters removed from a certain character index.
string | Qore::splice (string str, softint start, softint len, *string nstr)
| Returns a string based on the argument string but optionally with characters removed and/or added from a certain character index.
list | Qore::splice (list l, softint start)
| Returns a list based on the argument list but with elements removed from the given index to the end of the list.
list | Qore::splice (list l, softint start, softint len, *softlist nlist)
| Returns a list based on the argument list but optionally with elements removed and/or added from a certain index.
nothing | Qore::splice ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.
int | Qore::strtoint (string num, softint base=10)
| parses a string representing a number in a configurable base and returns the integer
nothing | Qore::strtoint ()
| This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

## Detailed Description

Miscellaneous functions

## Function Documentation

string Qore::backquote | ( | string | cmd | ) |

Executes a process and returns a string of the output (stdout only)

Restrictions:
  Qore::PO_NO_EXTERNAL_PROCESS

Parameters

  cmd | The shell command to executed as a subprocess

Returns
  The stdout of the shell command that was executed

Example:
  my string $files = $files = backquote("ls");

Exceptions

  BACKQUOTE-ERROR | An error occurred with the fork() or opening the stdout pipe

nothing Qore::backquote | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Restrictions:
  Qore::PO_NO_EXTERNAL_PROCESS

Code Flags:
  RUNTIME_NOOP

any Qore::call_builtin_function | ( | string | name,
|  |  | ...
| ) |  |

Calls a function and returns the return value, passing the remaining arguments after the function name to the builtin function.

Parameters

  name | The name of the builtin function to call
  ... | Any optional arguments to the function

Returns
  The value returned by the called function

Example:
  my any $result = call_builtin_function("func_name", $arg1, $arg2);

Exceptions

  INVALID-FUNCTION-ACCESS | Parse options do not allow access to the function
  NO-FUNCTION | The function does not exist

Note
  The function called could also throw other exceptions

Since
  0.8.4 this function no longer restricts its search to builtin functions as as of Qore 0.8.4 builtin and user functions are stored identically internally; there is only one function implementation which can contain both builtin and user variants

any Qore::call_builtin_function_args | ( | string | name,
|  | *softlist | vargs
| ) |  |

Calls a function and returns the return value, using the optional second argument as a list of arguments for the function.

Parameters

  name | The name of the builtin function to call
  vargs | Optionally a single argument to the function or a list of arguments to the function

Returns
  The value returned by the called function

Example:
  my any $result = call_builtin_function_args("func_name", ($arg1, $arg2));

Exceptions

  INVALID-FUNCTION-ACCESS | Parse options do not allow access to the function
  NO-FUNCTION | The function does not exist

Note
  The function called could also throw other exceptions

Since
  0.8.4 this function no longer restricts its search to builtin functions as as of Qore 0.8.4 builtin and user functions are stored identically internally; there is only one function implementation which can contain both builtin and user variants

any Qore::call_function | ( | string | name,
|  |  | ...
| ) |  |

Calls a function and returns the return value, passing the remaining arguments after the function name to the function.

Parameters

  name | The name of the function to call
  ... | Any optional arguments to the function

Returns
  The value returned by the called function

Example:
  my any $result = call_function("func_name", $arg1, $arg2);

Exceptions

  INVALID-FUNCTION-ACCESS | Parse options do not allow access to the function
  NO-FUNCTION | The function does not exist

Note
  The function called could also throw other exceptions

any Qore::call_function | ( | code | f,
|  |  | ...
| ) |  |

Calls the given call reference or closure and returns the result, passing the remaining arguments to the call reference or closure.

Parameters

  f | The call reference or closure
  ... | Any optional arguments to the call reference or closure

Example:
  my any $result = call_function($call_ref, $arg1, $arg2);

Note
  The call reference or closure called could also throw other exceptions

any Qore::call_function_args | ( | string | name,
|  | *softlist | vargs
| ) |  |

Calls a function and returns the return value, using the optional second argument as a list of arguments for the function.

Parameters

  name | The name of the function to call
  vargs | Optionally a single argument to the function or a list of arguments to the function

Returns
  The value returned by the called function

Example:
  my any $result = call_function_args("func_name", ($arg1, $arg2));

Exceptions

  INVALID-FUNCTION-ACCESS | Parse options do not allow access to the function
  NO-FUNCTION | The function does not exist

Note
  The function called could also throw other exceptions

any Qore::call_function_args | ( | code | f,
|  | *softlist | vargs
| ) |  |

Calls the given call reference or closure and returns the result, using the optional second argument as a list of arguments to the call reference or closure.

Parameters

  f | The call reference or closure
  vargs | Optionally a single argument to the call reference or closure or a list of arguments to the call reference or closure

Example:
  my any $result = call_function_args($call_ref, ($arg1, $arg2));

Note
  The call reference or closure called could also throw other exceptions

string Qore::decode_url | ( | string | url | ) |

Decodes percent numeric codes in a URL string and returns the decoded string.

Code Flags:
  CONSTANT

Parameters

  url | a URL string with percent-encodings to decode

Returns
  the URL string with all percent-encodings decoded

Example:
  my string $decoded_url = decode_url($encoded_url);

nothing Qore::decode_url | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

bool Qore::exists | ( |  | ... | ) |

A function performing the same role as the exists operator.

Code Flags:
  CONSTANT

Parameters

  ... | if only a single argument is passed, then this function returns True if the single argument exists, False if not; otherwise is multiple arguments are passed to the function, it always returns True; this is to emulate the behavior of the exists operator

Returns
  if only a single argument is passed, then this function returns True if the single argument exists, False if not; otherwise is multiple arguments are passed to the function, it always returns True; this is to emulate the behavior of the exists operator

Example:
  my bool $b = exists($val);

bool Qore::existsFunction | ( | string | name | ) |

Returns True if the function exists in the current program's function name space.

Code Flags:
  CONSTANT

Parameters

  name | the name of the function to check

Returns
  True if the function exists in the current program's function name space, False if not

Example:
  my bool $b = existsFunction("func_name");

bool Qore::existsFunction | ( | code | c | ) |

Always returns True.

This function variant is included for backwards-compatibility

Code Flags:
  NOOP

Parameters

  c | a call reference or closure:

Returns
  always returns True

nothing Qore::existsFunction | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

*string Qore::functionType | ( | string | name | ) |

Returns `"builtin"` (for a builtin function), `"user"` (for a user function), or NOTHING (if the function cannot be found) according to the function name passed.

Parameters

  name | The function name to check

Returns
  `"builtin"` (for a builtin function), `"user"` (for a user function), or NOTHING (if the function cannot be found) according to the function name passed

Example:
  my *string $type = functionType("print");

nothing Qore::functionType | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

*int Qore::get_byte | ( | string | str,
|  | softint | offset = `0`
| ) |  |

Returns the byte value at the given byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

Code Flags:
  CONSTANT

Parameters

  str | the string data to process
  offset | the byte offset of the data to retrieve (the first value is at offset 0)

Returns
  the byte value at the given byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data

Example:
  my *int $byte = get_byte($str, 2); # returns the third byte of the string

Note
  that for strings this function is not equivalent to the [] operator for multi-byte character encodings, as this function works purely on bytes and the [] operator operates on characters
  Furthermore this function is identical to getByte(), except this function has no RUNTIME_NOOP variant

*int Qore::get_byte | ( | binary | b,
|  | softint | offset = `0`
| ) |  |

Returns the byte value at the given byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

Code Flags:
  CONSTANT

Parameters

  b | the data to process
  offset | the byte offset of the data to retrieve (the first value is at offset 0)

Returns
  the byte value at the given byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data

Example:
  my *int $byte = get_byte($bin, 2); # returns the third byte of the binary object

Note
  this function is equivalent to the more efficient [] operator when used with a binary argument
  Furthermore this function is identical to getByte(), except this function has no RUNTIME_NOOP variant

string Qore::get_default_encoding | ( |  | ) |

Returns the name of the default character encoding.

Returns
  the name of the default character encoding

Example:
  my string $encoding = get_default_encoding();

string Qore::get_ex_pos | ( | hash | ex | ) |

returns a descriptive string for an exception location; the `source` and `offset` information will also be included in the string returned if present in the exception hash argument

Code Flags:
  CONSTANT

Example:
  try {
  throw "oops", sprintf("arg %y is invalid", $arg);
  }
  catch (hash $ex) {
  log("%s: %s: %s", get_ex_pos($ex), $ex.err, $ex.desc);
  }

Parameters

  an | exception hash

Returns
  a string describing the exception location (ex: `"sftp-poller.q:140"`)

Since
  Qore 0.8.7

int Qore::get_parse_options | ( |  | ) |

returns the current parse options for the current Program object

Code Flags:
  CONSTANT

Example:
  my int $i = get_parse_options();

Returns
  the current parse options for the current Program object

Since
  Qore 0.8.7

hash Qore::get_qore_library_info | ( |  | ) |

Returns a hash of library build and version info.

Returns
  a hash of library build and version info with the following keys:
  - `PlatformOS:` The operating system used to build the Qore library
  - `PlatformCPU:` The CPU used as a target for the Qore library build
  - `VersionString:` The full version string for this version of the Qore library
  - `VersionMajor:` An integer giving the Qore library's major version number
  - `VersionMinor:` An integer giving the Qore library's minor version number
  - `VersionSub:` An integer giving the Qore library's release version number
  - `Build:` An integer giving the Qore library's subversion revision number
  - `BuildHost:` A string giving information about the host used to compile the Qore library
  - `Compiler:` The compiler used to build the Qore library
  - `ModuleDir:` The module directory assumed by default in the Qore library
  - `CFLAGS:` The compiler flags used to compile the Qore library
  - `LDFLAGS:` The linker flags used to link the Qore library

Code Flags:
  CONSTANT

Example:
  my hash $h = get_qore_library_info();

hash Qore::get_qore_option_hash | ( |  | ) |

Returns a hash of hashes giving information about Qore library options for the current build.

Returns
  a hash of hashes giving information about Qore library options for the current build; the hash keys are the constant names and the values are hashes with the following keys:
  - `option:` The string description of the option
  - `constant:` A string giving the name of the constant that has the boolean value for this option (equal to the hash key name)
  - `type:` The type of option
  - `value:` The boolean value of the option

Code Flags:
  CONSTANT

Example:
  my hash $h = get_qore_option_hash();

See Also
  get_qore_option_list()

Since
  Qore 0.8.4

list Qore::get_qore_option_list | ( |  | ) |

Returns a list of hashes giving information about Qore library options for the current build.

Returns
  a list of hashes giving information about Qore library options for the current build; each hash will have the following keys:
  - `option:` The string description of the option
  - `constant:` A string giving the name of the constant that has the boolean value for this option
  - `type:` The type of option
  - `value:` The boolean value of the option

Code Flags:
  CONSTANT

Example:
  my list $l = get_qore_option_list();

See Also
  get_qore_option_hash()

*string Qore::get_script_dir | ( |  | ) |

Returns the name of the directory from which the current script was executed or NOTHING if unknown (i.e. no parent script, script read from stdin, etc)

Returns
  the name of the directory from which the current script was executed or NOTHING if unknown (i.e. no parent script, script read from stdin, etc)

Example:
  my *string $str = get_script_dir();

*string Qore::get_script_name | ( |  | ) |

Returns the filename of the current script if known or NOTHING if unknown (i.e. no parent script, script read from stdin, etc)

Returns
  the filename of the current script if known or NOTHING if unknown (i.e. no parent script, script read from stdin, etc)

Example:
  my *string $str = get_script_name();

*string Qore::get_script_path | ( |  | ) |

Returns the path (directory and filename) of the current script or NOTHING if unknown (i.e. no parent script, script read from stdin, etc)

Returns
  the path (directory and filename) of the current script or NOTHING if unknown (i.e. no parent script, script read from stdin, etc)

Example:
  my *string $str = get_script_path();

*int Qore::get_word_16 | ( | string | str,
|  | softint | offset = `0`
| ) |  |

Returns the 16-bit integer value at the given 2-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

This function assumes MSB byte order when retrieving the value from the data

Code Flags:
  CONSTANT

Parameters

  str | the string data to process
  offset | the 2-byte offset of the data to retrieve (the first value is at offset 0)

Returns
  the 16-bit integer value at the given 2-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data

Example:
  my *int $val = get_word_16($str, 2); # returns the third 2-byte (16-bit) value in the string

See Also
  get_word_16_lsb()

*int Qore::get_word_16 | ( | binary | b,
|  | softint | offset = `0`
| ) |  |

Returns the 16-bit integer value at the given 2-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

This function assumes MSB byte order when retrieving the value from the data

Code Flags:
  CONSTANT

Parameters

  b | the data to process
  offset | the 2-byte offset of the data to retrieve (the first value is at offset 0)

Returns
  the 16-bit integer value at the given 2-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data

Example:
  my *int $val = get_word_16($bin, 2); # returns the third 2-byte (16-bit) value in the binary object

See Also
  get_word_16_lsb()

*int Qore::get_word_16_lsb | ( | string | str,
|  | softint | offset = `0`
| ) |  |

Returns the 16-bit integer value at the given 2-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

This function assumes LSB byte order when retrieving the value from the data

Code Flags:
  CONSTANT

Parameters

  str | the string data to process
  offset | the 2-byte offset of the data to retrieve (the first value is at offset 0)

Returns
  the 16-bit integer value at the given 2-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data

Example:
  my *int $val = get_word_16_lsb($str, 2); # returns the third 2-byte (16-bit) value in the string

See Also
  get_word_16()

*int Qore::get_word_16_lsb | ( | binary | b,
|  | softint | offset = `0`
| ) |  |

Returns the 16-bit integer value at the given 2-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

This function assumes LSB byte order when retrieving the value from the data

Code Flags:
  CONSTANT

Parameters

  b | the data to process
  offset | the 2-byte offset of the data to retrieve (the first value is at offset 0)

Returns
  the 16-bit integer value at the given 2-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data

Example:
  my *int $val = get_word_16_lsb($bin, 2); # returns the third 2-byte (16-bit) value in the binary object

See Also
  get_word_16()

*int Qore::get_word_32 | ( | string | str,
|  | softint | offset = `0`
| ) |  |

Returns the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

This function assumes MSB byte order when retrieving the value from the data

Code Flags:
  CONSTANT

Parameters

  str | the string data to process
  offset | the 4-byte offset of the data to retrieve (the first value is at offset 0)

Returns
  the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data

Example:
  my *int $val = get_word_32($str, 4); # returns the third 4-byte (32-bit) value in the string

Note
  This function is identical to getWord32(), except this function has no RUNTIME_NOOP variant

See Also
  get_word_32_lsb()

*int Qore::get_word_32 | ( | binary | b,
|  | softint | offset = `0`
| ) |  |

Returns the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

This function assumes MSB byte order when retrieving the value from the data

Code Flags:
  CONSTANT

Parameters

  b | the data to process
  offset | the 4-byte offset of the data to retrieve (the first value is at offset 0)

Returns
  the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data

Example:
  my *int $val = get_word_32($bin, 2); # returns the third 4-byte (32-bit) value in the binary object

Note
  This function is identical to getWord32(), except this function has no RUNTIME_NOOP variant

See Also
  get_word_32_lsb()

*int Qore::get_word_32_lsb | ( | string | str,
|  | softint | offset = `0`
| ) |  |

Returns the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

This function assumes LSB byte order when retrieving the value from the data

Code Flags:
  CONSTANT

Parameters

  str | the string data to process
  offset | the 4-byte offset of the data to retrieve (the first value is at offset 0)

Returns
  the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data

Example:
  my *int $val = get_word_32_lsb($str, 4); # returns the third 4-byte (32-bit) value in the string

Note
  This function is identical to getWord32(), except this function has no RUNTIME_NOOP variant

See Also
  get_word_32()

*int Qore::get_word_32_lsb | ( | binary | b,
|  | softint | offset = `0`
| ) |  |

Returns the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

This function assumes LSB byte order when retrieving the value from the data

Code Flags:
  CONSTANT

Parameters

  b | the data to process
  offset | the 4-byte offset of the data to retrieve (the first value is at offset 0)

Returns
  the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data

Example:
  my *int $val = get_word_32_lsb($bin, 2); # returns the third 4-byte (32-bit) value in the binary object

See Also
  get_word_32()

*int Qore::get_word_64 | ( | string | str,
|  | softint | offset = `0`
| ) |  |

Returns the 64-bit integer value at the given 8-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

This function assumes MSB byte order when retrieving the value from the data

Code Flags:
  CONSTANT

Parameters

  str | the string data to process
  offset | the 8-byte offset of the data to retrieve (the first value is at offset 0)

Returns
  the 64-bit integer value at the given 8-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data

Example:
  my *int $val = get_word_64($str, 4); # returns the third 8-byte (64-bit) value in the string

See Also
  get_word_64_lsb()

*int Qore::get_word_64 | ( | binary | b,
|  | softint | offset = `0`
| ) |  |

Returns the 64-bit integer value at the given 8-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

This function assumes MSB byte order when retrieving the value from the data

Code Flags:
  CONSTANT

Parameters

  b | the data to process
  offset | the 8-byte offset of the data to retrieve (the first value is at offset 0)

Returns
  the 64-bit integer value at the given 8-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data

Example:
  my *int $val = get_word_64($bin, 2); # returns the third 8-byte (64-bit) value in the binary object

See Also
  get_word_64_lsb()

*int Qore::get_word_64_lsb | ( | string | str,
|  | softint | offset = `0`
| ) |  |

Returns the 64-bit integer value at the given 8-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

This function assumes LSB byte order when retrieving the value from the data

Code Flags:
  CONSTANT

Parameters

  str | the string data to process
  offset | the 8-byte offset of the data to retrieve (the first value is at offset 0)

Returns
  the 64-bit integer value at the given 8-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data

Example:
  my *int $val = get_word_64_lsb($str, 4); # returns the third 8-byte (64-bit) value in the string

See Also
  get_word_64()

*int Qore::get_word_64_lsb | ( | binary | b,
|  | softint | offset = `0`
| ) |  |

Returns the 64-bit integer value at the given 8-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

This function assumes LSB byte order when retrieving the value from the data

Code Flags:
  CONSTANT

Parameters

  b | the data to process
  offset | the 8-byte offset of the data to retrieve (the first value is at offset 0)

Returns
  the 64-bit integer value at the given 8-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data

Example:
  my *int $val = get_word_64_lsb($bin, 2); # returns the third 8-byte (64-bit) value in the binary object

See Also
  get_word_64()

*int Qore::getByte | ( | string | str,
|  | softint | offset = `0`
| ) |  |

Returns the byte value at the given byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

Code Flags:
  CONSTANT, DEPRECATED

Parameters

  str | the string data to process
  offset | the byte offset of the data to retrieve (the first value is at offset 0)

Returns
  the byte value at the given byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data

Example:
  my *int $byte = get_byte($str, 2); # returns the third byte of the string

Note
  that for strings this function is not equivalent to the [] operator for multi-byte character encodings, as this function works purely on bytes and the [] operator operates on characters
  Furthermore this function is identical to get_byte(), except this function has a RUNTIME_NOOP variant

Since
  Qore 0.8.4 marked as deprecated; use the get_byte() function instead

nothing Qore::getByte | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP, DEPRECATED

*int Qore::getByte | ( | binary | b,
|  | softint | offset = `0`
| ) |  |

Returns the byte value at the given byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

Code Flags:
  CONSTANT, DEPRECATED

Parameters

  b | the data to process
  offset | the byte offset of the data to retrieve (the first value is at offset 0)

Returns
  the byte value at the given byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data

Example:
  my *int $byte = get_byte($bin, 2); # returns the third byte of the binary object

Note
  this function is equivalent to the more efficient [] operator when used with a binary argument
  Furthermore this function is identical to get_byte(), except this function has a RUNTIME_NOOP variant

Since
  Qore 0.8.4 marked as deprecated; use the get_byte() function instead

string Qore::getClassName | ( | object | obj | ) |

Returns the class name of the object passed.

Parameters

  obj | the object to get the class name of

Returns
  the class name of the object passed

Example:
  my string $name = getClassName($obj);

nothing Qore::getClassName | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

list Qore::getFeatureList | ( |  | ) |

Returns a list of strings of the builtin and module-supplied features of Qore.

Returns
  a list of strings of the builtin and module-supplied features of Qore

Code Flags:
  CONSTANT

Example:
  my list $list = getFeatureList();

hash Qore::getModuleHash | ( |  | ) |

Returns a hash of hashes describing the currently-loaded Qore modules; the top-level hash keys are the module names.

Returns
  a hash of hashes describing the currently-loaded Qore modules; the top-level hash keys are the module names; the values are hashes with the following keys:
  - `filename:` the path to the module
  - `name:` the name of the module
  - `desc:` the description of the module
  - `version:` the version of the module
  - `author:` the author of the module
  - `api_major:` the major number of the Qore module API version the module support
  - `api_minor:` the minor number of the Qore module API version the module support
  - `url:` the module's URL

Code Flags:
  CONSTANT

Example:
  my hash $mh = getModuleHash();

Since
  Qore 0.8.1

list Qore::getModuleList | ( |  | ) |

Returns a list of hashes describing the currently-loaded Qore modules.

Returns
  a list of hashes describing the currently-loaded Qore modules; each element in the list is a hash with the following keys:
  - `filename:` the path to the module
  - `name:` the name of the module
  - `desc:` the description of the module
  - `version:` the version of the module
  - `author:` the author of the module
  - `api_major:` the major number of the Qore module API version the module support
  - `api_minor:` the minor number of the Qore module API version the module support
  - `url:` the module's URL

Code Flags:
  CONSTANT

Example:
  my list $list = getModuleList();

See Also
  getModuleHash()

*int Qore::getWord32 | ( | string | str,
|  | softint | offset = `0`
| ) |  |

Returns the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

This function assumes MSB byte order when retrieving the value from the data

Code Flags:
  CONSTANT, DEPRECATED

Parameters

  str | the string data to process
  offset | the 4-byte offset of the data to retrieve (the first value is at offset 0)

Returns
  the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data

Example:
  my *int $val = getWord32($str, 4); # returns the third 4-byte (32-bit) value in the string

Note
  This function is identical to get_word_32(), except this function has a RUNTIME_NOOP variant

Since
  Qore 0.8.4 marked as deprecated; use the get_word_32() function instead

*int Qore::getWord32 | ( | binary | b,
|  | softint | offset = `0`
| ) |  |

Returns the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data.

This function assumes MSB byte order when retrieving the value from the data

Code Flags:
  CONSTANT, DEPRECATED

Parameters

  b | the data to process
  offset | the 4-byte offset of the data to retrieve (the first value is at offset 0)

Returns
  the 32-bit integer value at the given 4-byte offset (the first value is at offset 0) or NOTHING if the offset is not legal for the given data

Example:
  my *int $val = getWord32($bin, 2); # returns the third 4-byte (32-bit) value in the binary object

Note
  This function is identical to get_word_32(), except this function has a RUNTIME_NOOP variant

Since
  Qore 0.8.4 marked as deprecated; use the get_word_32() function instead

nothing Qore::getWord32 | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

bool Qore::has_key | ( | hash | h,
|  | string | key
| ) |  |

Returns True if the given key exists in the hash (does not necessarily have to have a value assigned); exceptions are only raised if string encoding errors are encountered.

Parameters

  h | the hash to check
  key | the key name to check; this value will be converted to the default character encoding to check the hash

Returns
  True if the given key exists in the hash (does not necessarily have to have a value assigned), False if the key is not present at all

Example:
  my bool $b = has_key($hash, "key");

Exceptions

  ENCODING-CONVERSION-ERROR | this error is thrown if the given key cannot be converted to the default character encoding

bool Qore::has_key | ( | object | obj,
|  | string | key
| ) |  |

Returns True if the given key exists in the object (does not necessarily have to have a value assigned); exceptions are only raised if string encoding errors are encountered or in case of object access errors.

Example:
  my bool $b = has_key($obj, "key");

Exceptions

  ENCODING-CONVERSION-ERROR | this error is thrown if the given key cannot be converted to the default character encoding

Note
  object access exceptions could also be raised

list Qore::hash_values | ( | hash | h | ) |

Returns a list of all the values in the hash argument passed.

Code Flags:
  CONSTANT

Parameters

  h | a hash to get all the values of

Returns
  a list of all the values in the hash argument passed

Example:
  my list $vl = hash_values($vl);

Note
  equivalent to <hash>::values()

See Also
  <hash>::keys()

nothing Qore::hash_values | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

int Qore::hextoint | ( | string | str | ) |

Returns an integer for a hexadecimal string value; throws an exception if non-hex digits are found.

Parameters

  str | a string of hexadecimal digits (like `"6d4f84e0"`; with or without leading `"x"` or `"0x"`)

Returns
  the base-10 integer corresponding to the argument

Example:
  my int $i = hextoint("ab3d4e0f12");

Exceptions

  PARSE-HEX-ERROR | invalid hex digit found

nothing Qore::hextoint | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

string Qore::html_decode | ( | string | str | ) |

Returns a string with any HTML escape codes translated to the original characters.

Code Flags:
  CONSTANT

Parameters

  str | the argument to decode

Returns
  the string passed as an argument with any HTML escape codes translated to the original characters

Example:
  my string $str = html_decode("&lt;hello&gt;"); # returns "<hello>"

nothing Qore::html_decode | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

string Qore::html_encode | ( | string | str | ) |

Returns a string with characters needing HTML escaping translated to HTML escape codes.

Code Flags:
  CONSTANT

Parameters

  str | the argument to process

Returns
  the string passed as an argument with characters needing HTML escaping translated to HTML escape codes

Example:
  my string $str = html_encode("<hello>"); # returns "&lt;hello&gt;"

nothing Qore::html_encode | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

nothing Qore::load_module | ( | string | name | ) |

Loads in a Qore module at run-time.

If a feature with the same name already exists, then this feature's code is imported into the current Program object if necessary and no further action is taken.

Note that modules providing objects resolved at parse time (classes, constants, functions, etc) must be loaded with the %requires directive instead, unless all references to the objects provided by the module will be made in code embedded in child Program objects.

Restrictions:
  Qore::PO_NO_MODULES

Parameters

  name | either a feature name (a module will be searched with this feature name) or a path to a module to load

Example:
  load_module("mysql");

Exceptions

  LOAD-MODULE-ERROR | module cannot be loaded: API incompatibility, module defines symbols already defined in the target object, etc

See Also
  getModuleHash(), getFeatureList()

Since
  Qore 0.8.7 this function can also be used in user module code

nothing Qore::load_module | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Restrictions:
  Qore::PO_NO_MODULES

Code Flags:
  RUNTIME_NOOP

string Qore::makeBase64String | ( | string | str,
|  | softint | maxlinelen = `-1`
| ) |  |

Returns a base64-encoded representation of a string.

Implementation based on RFC-1421 and RFC-2045

Code Flags:
  CONSTANT

Parameters

  str | the string to encode
  maxlinelen | the maximum length of a line in the resulting output string in bytes; if this value is > 0 then output lines will be separated by CRLF characters

Returns
  the base64-encoded string of the data passed

Example:
  my string $base64 = makeBase64String($data, 64);

Since
  the maxlinelen parameter was added in Qore 0.8.4

See Also
  makeHexString()

string Qore::makeBase64String | ( | binary | bin,
|  | softint | maxlinelen = `-1`
| ) |  |

Returns a base64-encoded representation of a binary object.

Implementation based on RFC-1421 and RFC-2045

Code Flags:
  CONSTANT

Parameters

  bin | the data to encode
  maxlinelen | the maximum length of a line in the resulting output string in bytes; if this value is > 0 then output lines will be separated by CRLF characters

Returns
  the base64-encoded string of the data passed

Example:
  my string $base64 = makeBase64String($data, 64);

Since
  the maxlinelen parameter was added in Qore 0.8.4

nothing Qore::makeBase64String | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

string Qore::makeHexString | ( | string | str | ) |

Returns a hex-encoded representation of a string.

Code Flags:
  CONSTANT

Parameters

  str | the string to encode

Returns
  a string of hex digits repsenting the bytes of the argument passed

Example:
  my string $str = makeHexString($str2);

See Also
  makeBase64String()

string Qore::makeHexString | ( | binary | bin | ) |

Returns a hex-encoded representation of a binary object.

Parameters

  bin | the binary object to encode

Returns
  a string of hex digits repsenting the bytes of the argument passed

Example:
  my string $str = makeHexString($bin);

See Also
  makeBase64String()

nothing Qore::makeHexString | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

*hash Qore::parse | ( | string | code,
|  | string | label,
|  | *softint | warning_mask,
|  | *string | source,
|  | *softint | offset,
|  | softbool | format_label = `True`
| ) |  |

Adds the text passed to the current program's code, tagged with the given label.

Restrictions:
  Qore::PO_NO_EMBEDDED_LOGIC, Qore::PO_IN_MODULE

Parameters

  code | the string of Qore source code to parse; the parsed code will be added to the current program
  label | a label identifying the code or the code's source
  warning_mask | An optional warning mask; see Warning Constants for values to combine by binary-or; if this arguments is 0 or not given then no warnings will be checked or issued and the return value will always be NOTHING
  source | An optional source file name for the code being parsed; this is useful if sections of a file are parsed
  offset | An optional line offset for use with the source parameter; this gives the line offset in the file to the code being parsed
  format_label | If this argument is True, then the label is formatted as `"<run-time-loaded: label>"`; if False, then it is passed as-is

Example:
  parse($code, $filename);

Note
  This function could throw many parse exceptions which are not enumerated here; any parse errors will result in an appropriate exception.

See Also
  - Qore::Program::parse()
  - Qore::Program::parsePending()

Since
  Qore 0.8.7 the optional warning_mask, source, offset, and format_label arguments were added; also label formatting was added; these changes were made to align the functionality of this function with the Program::parse() and Program::parsePending() methods

nothing Qore::parse | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Restrictions:
  Qore::PO_NO_EMBEDDED_LOGIC, Qore::PO_IN_MODULE

Code Flags:
  RUNTIME_NOOP

hash Qore::parse_url | ( | string | url,
|  | bool | keep_brackets = `False`
| ) |  |

Parses a URL string and returns a hash of the components; throws an exception if the string cannot be parsed as a URL.

Parameters

  url | the URL to parse (ex: `"https://user:pass@host:8080/path"`); either a hostname or path is required at a minimum or a `PARSE-URL-ERROR` exception is raised
  keep_brackets | if this argument is true then if the hostname or address is enclosed in square brackets, then the brackets will be included in the `"host"` key output as well; square brackets are used by some Qore methods to denote IPv6 addresses; for example see Socket::connect()

Returns
  a hash of the components of the URL with the following keys (if data in the URL is present; note that at least either the `"host"` or the `"path"` keys will always be returned if no `PARSE-URL-ERROR` is raised):
  - `protocol:` the scheme in the URL (ex: `"http"`)
  - `path:` any path given in the URL; the path will be prefixed by `"/"` if a hostname is found in the URL argument string, otherwise it will not if it was not given as such in the argument string
  - `username:` any username given in the URL
  - `password:` any password given in the URL
  - `host:` any hostname given in the URL; note that this key will be given if no other information can be found in the URL argument and the URL argument string has no `"/"` characters; depending on the usage context for this function, this may actually be a filename
  - `port:` any port number given in the URL

Example:
  my hash $hash = parse_url($url_string);

Exceptions

  PARSE-URL-ERROR | The URL string given could not be parsed

See Also
  parseURL() for a version of this function that does not throw exceptions if the URL cannot be parsed

binary Qore::parseBase64String | ( | string | str | ) |

Parses a base64 encoded string and returns a binary object of the decoded data.

Implementation based on RFC-1421 and RFC-2045

Parameters

  str | the base64-encoded input data to decode

Returns
  a binary object of the decoded data

Example:
  my binary $bin = parseBase64String($base64_string);

Exceptions

  BASE64-PARSE-ERROR | A syntax error occurred parsing the base64 string (invalid character, etc)

See Also
  parseHexString(), parseBase64StringToString()

nothing Qore::parseBase64String | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

string Qore::parseBase64StringToString | ( | string | str,
|  | *string | encoding
| ) |  |

Parses a base64 encoded string and returns a string of the decoded data.

Implementation based on RFC-1421 and RFC-2045

Parameters

  str | the base64-encoded input data to decode
  encoding | the character encoding tag for the string return value; if not present, the default character encoding is assumed.

Returns
  a string of the decoded data tagged with the given encoding

Example:
  my string $str = parseBase64String($base64_string);

Exceptions

  BASE64-PARSE-ERROR | A syntax error occurred parsing the base64 string (invalid character, etc)

Since
  the encoding parameter was added in Qore 0.8.4

See Also
  parseBase64String()

nothing Qore::parseBase64StringToString | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

binary Qore::parseHexString | ( | string | hexstr | ) |

Parses a hex-encoded string and returns the binary object.

Parameters

  hexstr | a string of an even-number of only hexadecimal digits

Returns
  a binary object of the decoded data

Example:
  my binary $bin = parseHexString($hex_string);

Exceptions

  PARSE-HEX-ERROR | A syntax error occurred parsing the hex string (odd number of digits, invalid hex character, etc)

See Also
  parseBase64String()

nothing Qore::parseHexString | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

*hash Qore::parseURL | ( | string | url,
|  | bool | keep_brackets = `False`
| ) |  |

Parses a URL string and returns a hash of the components; if the URL cannot be parsed then NOTHING is returned.

Parameters

  url | the URL to parse (ex: `"https://user:pass@host:8080/path"`); either a hostname or path is required at a minimum or the function will return NOTHING
  keep_brackets | if this argument is true then if the hostname or address is enclosed in square brackets, then the brackets will be included in the `"host"` key output as well; square brackets are used by some Qore methods to denote IPv6 addresses; for example see Socket::connect()

Returns
  a hash of the components of the URL with the following keys (if data in the URL is present; note that at least either the `"host"` or the `"path"` keys will always be returned if a hash is returned):
  - `protocol:` the scheme in the URL (ex: `"http"`)
  - `path:` any path given in the URL; the path will be prefixed by `"/"` if a hostname is found in the URL argument string, otherwise it will not if it was not given as such in the argument string
  - `username:` any username given in the URL
  - `password:` any password given in the URL
  - `host:` any hostname given in the URL; note that this key will be given if no other information can be found in the URL argument and the URL argument string has no `"/"` characters; depending on the usage context for this function, this may actually be a filename
  - `port:` any port number given in the URL

Example:
  my *hash $hash = parseURL($url_string);

See Also
  parse_url() for a version of this function that throws exceptions if the URL cannot be parsed

nothing Qore::parseURL | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

string Qore::splice | ( | string | str | ) |

This function always returns an empty string `""`.

This function variant is included for backwards-compatibility

Code Flags:
  NOOP

Parameters

  str | no action is taken on the argument

Returns
  always returns an empty string `""`

string Qore::splice | ( | string | str,
|  | softint | start
| ) |  |

Returns a string based on the argument string but with characters removed from a certain character index.

An exception can only be thrown here if an invalid multi-byte encoding is found

Parameters

  str | the string to process
  start | the character index (where the first character is 0) to start removing characters; if this value is negative, it gives the offset from the end of the string

Returns
  the processed string

Example:
  my string $str = splice($str2, 5);

See Also
  the splice operator

string Qore::splice | ( | string | str,
|  | softint | start,
|  | softint | len,
|  | *string | nstr
| ) |  |

Returns a string based on the argument string but optionally with characters removed and/or added from a certain character index.

An exception can only be thrown here if an invalid multi-byte encoding is found

Parameters

  str | the string to process
  start | the character index (where the first character is 0) to start removing (and/or adding) characters; if this value is negative, it gives the offset from the end of the string
  len | the number of characters to remove; if this argument is 0 then no characters are removed; if this value is negative, then it gives an offset from the end of the string (ie -2 means remove all characters up to but not including the two last characters)
  nstr | the optional string for inserting new characters

Returns
  the processed string with characters removed and/or added according to the arguments

Example:
  my string $str = splice($str2, 5, 7, "hello");

See Also
  the splice operator

list Qore::splice | ( | list | l,
|  | softint | start
| ) |  |

Returns a list based on the argument list but with elements removed from the given index to the end of the list.

Exceptions can only be thrown here if objects are removed from the list and this causes them to go out of scope and an exception is thrown in one of the destructors

Parameters

  l | the list to process
  start | the starting element (where the first element is 0) to start removing elements; if this value is negative, it gives the offset from the end of the list

Example:
  my list $l = splice($l2, 5);

See Also
  the splice operator

list Qore::splice | ( | list | l,
|  | softint | start,
|  | softint | len,
|  | *softlist | nlist
| ) |  |

Returns a list based on the argument list but optionally with elements removed and/or added from a certain index.

Exceptions can only be thrown here if objects are removed from the list and this causes them to go out of scope and an exception is thrown in one of the destructors

Parameters

  l | the list to process
  start | the starting element (where the first element is 0) to start removing (and/or adding) elements; if this value is negative, it gives the offset from the end of the list
  len | the number of list elements to remove; if this argument is 0 then no elements are removed; if this value is negative, then it gives an offset from the end of the list (ie -2 means remove all elements up to but not including the two last elements)
  nlist | the optional list for inserting new elements

Returns
  the processed list with elements removed and/or added according to the arguments

Example:
  my list $l = splice($l2, 5, 7, "hello");

See Also
  the splice operator

nothing Qore::splice | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP

int Qore::strtoint | ( | string | num,
|  | softint | base = `10`
| ) |  |

parses a string representing a number in a configurable base and returns the integer

Parameters

  num | a string representing a number
  base | the base of the number

Returns
  the integer represented by the string and the base

Example:
  my int $i = strtoint("41", 8);

Exceptions

  STRTOINT-ERROR | cannot parse string; unsupported base, etc

nothing Qore::strtoint | ( |  | ) |

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
  RUNTIME_NOOP