Loading...
Searching...
No Matches
Util Module

# Util Module Introduction

The Util module provides some generally-useful routines that are more suitable for writing in Qore than in C++.

To use this module, use `"%requires Util"` in your code.

All the public symbols in the module are defined in the Util namespace

Functions:

- Util::check_exception_serializable()
- Util::compare_version()
- Util::flatten()
- Util::get_bit_string()
- Util::get_byte_size()
- Util::get_exception_string()
- Util::get_marketing_byte_size()
- Util::get_random_string()
- Util::glob_to_regex()
- Util::is_int()
- Util::is_float()
- Util::is_number()
- Util::lpad()
- Util::make_uri_query()
- Util::normalize_dir()
  - Util::normalize_dir_unix()
  - Util::normalize_dir_windows()
- Util::ordinal()
- Util::parse_memory_size()
- Util::parse_ranges()
- Util::parse_to_qore_value()
- Util::parse_uri_query()
- Util::plural()
- Util::regex_escape()
- Util::rpad()
- Util::same()
- Util::slice()
- Util::tmp_location()
- Util::uniq()
- Util::zip()

# Release Notes

## Util 2.0

- added get_bit_string()
- added file references to parse_to_qore_value()

## Util 1.11

- added AllowedValueInfo

## Util 1.10

- added the Util::check_exception_serializable() "check_exception_serializable()" method (issue 4708)

## Util 1.9

- added a `path_params` element to the UriQueryInfo typed hash to allow for reporting path arguments in calls supported by REST schemas (issue 4661)

## Util 1.8.1

- fixed a bug in substitute_env_vars() where an exception would be thrown if any referenced environment variable was not set (issue 4632)

## Util 1.8

- added get_relative_path() (issue 4488)

## Util 1.7

- parse_uri_query() fails if the string has newlines in it (issue 4429)
- implemented the serialize_to_string() API (issue 4428)

## Util 1.6.2

- fixed a bug in `parse_to_qore_value()` with floats and numbers with trailing zeros (issue 4349)

## Util 1.6.1

- fixed a bug in `parse_memory_size()` with numbers larger than `9` (issue 4198)

## Util 1.6

- added the parse_memory_size() function (issue 4004)

## Util 1.5.1

- fixed bugs in `EVAL=` expressions in parse_to_qore_value() where expressions that evaluated to integer 0 or floating-point values were returned as NOTHING (issue 3851)
- added the get_file_from_url() function

## Util 1.5

- added the get_file_from_url() function

## Util 1.4.1

- fixed a bug in get_exception_string() with Java exceptions (issue 3304)

## Util 1.4

- added the parse_ranges() function (issue 2438)
- added the check_ip_address() function (issue 2483)
- updated parse_to_qore_value() to support single-element lists and hashes with curly brackets including empty hashes (issue 3138)
- updated get_exception_string() to show the `lang` value (issue 3182)

## Util 1.3

- updated for complex types
- added the make_uri_query() function
- added the parse_uri_query() function
- added the UriQueryInfo hashdecl
- added the flatten() function
- added the uniq() function

## Util 1.2

- the following functions are now actually implemented in the Qore library and only reexported here for backwards-compatibility:
  - Qore::absolute_path()
  - Qore::absolute_path_windows()
  - Qore::absolute_path_unix()
- added Util::glob_to_regex()
- added Util::is_int()
- added Util::is_float()
- added Util::is_number()
- added Util::lpad()
- added Util::ordinal()
- added Util::plural()
- added Util::regex_escape()
- added Util::rpad()
- added Util::same()
- added Util::slice()
- added Util::tmp_location()
- added Util::zip()
- fixed Util::get_random_string() on Windows
- fixed Util::absolute_path_windows()
- fixed Util::parse_to_qore_value() with hashes with a comma in the first key name; now respects parentheses when parsing lists and hashes (issue 846)
- fixed Util::normalize_dir_windows() handling of UNC paths (issue 813)

## Util 1.1

- added the Util::get_byte_size() and Util::get_marketing_byte_size() functions

## Util 1.0

- the initial version of the Util module