ADTF  3.18.2
a_util::strings Namespace Reference

Serves as component for string handling and conversion functionality. More...

Namespaces

 unicode
 Serves as component for unicode (UTF-8, UTF-16) string handling.
 

Classes

struct  ToNumericConverter
 Safe convenience string-to-numeric conversion methods for generic programming. More...
 
struct  IsNumericConvertible
 Convenience methods to validate string-to-numeric conversion for generic programming. More...
 

Functions

template<typename Numeric >
bool toNumeric (const char *from, Numeric &to)
 Safely convert a string to a value of type Numeric in a generic manner. More...
 
template<typename Numeric >
bool toNumeric (const std::string &from, Numeric &to)
 Safely convert a string to a value of type Numeric in a generic manner. More...
 
template<typename Numeric >
Numeric toNumeric (const char *from)
 Convert a string to a numeric value in a generic manner. More...
 
template<typename Numeric >
Numeric toNumeric (const std::string &from)
 Convert a string to a numeric value in a generic manner. More...
 
template<typename Numeric >
bool isNumeric (const char *str)
 Check whether a string is convertible to a value of type Numeric for generic programming. More...
 
template<typename Numeric >
bool isNumeric (const std::string &str)
 Check whether a string is convertible to a value of type Numeric for generic programming. More...
 
bool toBool (const std::string &from, bool &to)
 Safely convert a string to a boolean value. More...
 
bool toInt8 (const std::string &from, std::int8_t &to)
 Safely convert a string to a numeric value. More...
 
bool toInt16 (const std::string &from, std::int16_t &to)
 Safely convert a string to a numeric value. More...
 
bool toInt32 (const std::string &from, std::int32_t &to)
 Safely convert a string to a numeric value. More...
 
bool toInt64 (const std::string &from, std::int64_t &to)
 Safely convert a string to a numeric value. More...
 
bool toUInt8 (const std::string &from, std::uint8_t &to)
 Safely convert a string to a numeric value. More...
 
bool toUInt16 (const std::string &from, std::uint16_t &to)
 Safely convert a string to a numeric value. More...
 
bool toUInt32 (const std::string &from, std::uint32_t &to)
 Safely convert a string to a numeric value. More...
 
bool toUInt64 (const std::string &from, std::uint64_t &to)
 Safely convert a string to a numeric value. More...
 
bool toFloat (const std::string &from, float &to)
 Safely convert a string to a numeric value. More...
 
bool toDouble (const std::string &from, double &to)
 Safely convert a string to a numeric value. More...
 
bool toBool (const char *from, bool &to)
 Safely convert a string to a boolean value. More...
 
bool toInt8 (const char *from, std::int8_t &to)
 Safely convert a string to a numeric value. More...
 
bool toInt16 (const char *from, std::int16_t &to)
 Safely convert a string to a numeric value. More...
 
bool toInt32 (const char *from, std::int32_t &to)
 Safely convert a string to a numeric value. More...
 
bool toInt64 (const char *from, std::int64_t &to)
 Safely convert a string to a numeric value. More...
 
bool toUInt8 (const char *from, std::uint8_t &to)
 Safely convert a string to a numeric value. More...
 
bool toUInt16 (const char *from, std::uint16_t &to)
 Safely convert a string to a numeric value. More...
 
bool toUInt32 (const char *from, std::uint32_t &to)
 Safely convert a string to a numeric value. More...
 
bool toUInt64 (const char *from, std::uint64_t &to)
 Safely convert a string to a numeric value. More...
 
bool toFloat (const char *from, float &to)
 Safely convert a string to a numeric value. More...
 
bool toDouble (const char *from, double &to)
 Safely convert a string to a numeric value. More...
 
bool toBool (const std::string &from)
 Convert a string to a boolean value. More...
 
std::int8_t toInt8 (const std::string &from)
 Convert a string to a numeric value. More...
 
std::int16_t toInt16 (const std::string &from)
 Convert a string to a numeric value. More...
 
std::int32_t toInt32 (const std::string &from)
 Convert a string to a numeric value. More...
 
std::int64_t toInt64 (const std::string &from)
 Convert a string to a numeric value. More...
 
std::uint8_t toUInt8 (const std::string &from)
 Convert a string to a numeric value. More...
 
std::uint16_t toUInt16 (const std::string &from)
 Convert a string to a numeric value. More...
 
std::uint32_t toUInt32 (const std::string &from)
 Convert a string to a numeric value. More...
 
std::uint64_t toUInt64 (const std::string &from)
 Convert a string to a numeric value. More...
 
float toFloat (const std::string &from)
 Convert a string to a numeric value. More...
 
double toDouble (const std::string &from)
 Convert a string to a numeric value. More...
 
bool toBool (const char *from)
 Convert a string to a boolean value. More...
 
std::int8_t toInt8 (const char *from)
 Convert a string to a numeric value. More...
 
std::int16_t toInt16 (const char *from)
 Convert a string to a numeric value. More...
 
std::int32_t toInt32 (const char *from)
 Convert a string to a numeric value. More...
 
std::int64_t toInt64 (const char *from)
 Convert a string to a numeric value. More...
 
std::uint8_t toUInt8 (const char *from)
 Convert a string to a numeric value. More...
 
std::uint16_t toUInt16 (const char *from)
 Convert a string to a numeric value. More...
 
std::uint32_t toUInt32 (const char *from)
 Convert a string to a numeric value. More...
 
std::uint64_t toUInt64 (const char *from)
 Convert a string to a numeric value. More...
 
float toFloat (const char *from)
 Convert a string to a numeric value. More...
 
double toDouble (const char *from)
 Convert a string to a numeric value. More...
 
std::string format (const char *str_format,...)
 printf()-like formatting of an input string. More...
 
std::string format (std::size_t initial_buffer_size, const char *str_format,...)
 printf()-like formatting of an input string with a given destination string buffer size. More...
 
std::string & format (std::string &buffer, std::size_t &pos, const char *str_format,...)
 printf()-like formatting of an input string with a given destination string buffer. More...
 
std::string toString (bool from)
 Convert the boolean value to its string representation. More...
 
std::string toString (std::int8_t from)
 Convert the given value to a standard string. More...
 
std::string toString (std::int16_t from)
 Convert the given value to a standard string. More...
 
std::string toString (std::int32_t from)
 Convert the given value to a standard string. More...
 
std::string toString (std::int64_t from)
 Convert the given value to a standard string. More...
 
std::string toString (std::uint8_t from)
 Convert the given value to a standard string. More...
 
std::string toString (std::uint16_t from)
 Convert the given value to a standard string. More...
 
std::string toString (std::uint32_t from)
 Convert the given value to a standard string. More...
 
std::string toString (std::uint64_t from)
 Convert the given value to a standard string. More...
 
std::string toString (float from)
 Convert the given value to a standard string. More...
 
std::string toString (double from)
 Convert the given value to a standard string. More...
 
int compare (const char *left, const char *right)
 Compares two 0-terminated C-strings. More...
 
int compare (const char *left, const char *right, std::size_t pos)
 Compares two 0-terminated C-strings. More...
 
int compare (const char *left, const char *right, std::size_t pos, std::size_t length)
 Compares two 0-terminated C-strings. More...
 
int compareNoCase (const char *left, const char *right)
 Compares two 0-terminated C-strings, ignoring the case using _tcsicmp. More...
 
int compareNoCase (const char *left, const char *right, std::size_t pos)
 Compares two 0-terminated C-strings, ignoring the case using _tcsicmp. More...
 
int compareNoCase (const char *left, const char *right, std::size_t pos, std::size_t length)
 Compares two 0-terminated C-strings, ignoring the case using _tcsicmp. More...
 
bool isEqual (const char *left, const char *right)
 Compares two 0-terminated C-strings for equality. More...
 
bool isEqual (const char *left, const char *right, std::size_t pos)
 Compares two 0-terminated C-strings for equality. More...
 
bool isEqual (const char *left, const char *right, std::size_t pos, std::size_t length)
 Compares two 0-terminated C-strings for equality. More...
 
bool isEqualNoCase (const char *left, const char *right)
 Compares two 0-terminated C-strings for equality ignoring their case. More...
 
bool isEqualNoCase (const char *left, const char *right, std::size_t pos)
 Compares two 0-terminated C-strings for equality ignoring their case. More...
 
bool isEqualNoCase (const char *left, const char *right, std::size_t pos, std::size_t length)
 Compares two 0-terminated C-strings for equality ignoring their case. More...
 
std::size_t getLength (const char *str)
 Counts the number of characters in a 0-terminated C-string. More...
 
std::size_t copy (char *dest, std::size_t dest_size, const char *source)
 Copies up to dest_size-1 characters from source to dest, ensuring null termination. More...
 
std::size_t copy (char *dest, std::size_t dest_size, const char *source, std::size_t count)
 Copies up to count characters from source to dest, ensuring null termination. More...
 
std::vector< std::string > split (const std::string &str, const std::string &separator)
 Splits a string using a specified separator string. More...
 
std::vector< std::string > split (const std::string &str, const std::string &separator, bool keep_empty)
 Splits a string using a specified separator string. More...
 
std::vector< std::string > splitToken (const std::string &str)
 Splits a string on whitespace characters. More...
 
std::vector< std::string > splitToken (const std::string &str, const std::string &separators)
 Splits a string using a set of separator characters. More...
 
std::vector< std::string > splitToken (const std::string &str, const std::string &separators, bool keep_empty)
 Splits a string using a set of separator characters. More...
 
std::string & trim (std::string &str)
 Trims all whitespace characters from the start and end of a string. More...
 
std::string & trim (std::string &str, const std::string &trimmed_chars)
 Trims a specified set of characters from the start and end of a string. More...
 
bool isEmpty (const char *str)
 Checks whether a C-style string is empty, meaning nullptr or "". More...
 
bool isNotEmpty (const char *str)
 Checks whether a C-style string is not empty, meaning neither nullptr nor "". More...
 
std::string & replace (std::string &str, const std::string &subject, const std::string &replacement)
 In-place replacement of all occurences of subject with replacement. More...
 
std::string replace (const std::string &str, const std::string &subject, const std::string &replacement)
 Replace all occurences of subject with replacement. More...
 
std::string join (const std::vector< std::string > &strings, const std::string &delimiter)
 Joins all strings from the vector into one string, separated by the specified delimiter string. More...
 
bool isBool (const std::string &str)
 Check whether a string can be converted to a boolean type. More...
 
bool isInt8 (const std::string &str)
 Check whether a string can be converted to a value of the given numeric type. More...
 
bool isInt16 (const std::string &str)
 Check whether a string can be converted to a value of the given numeric type. More...
 
bool isInt32 (const std::string &str)
 Check whether a string can be converted to a value of the given numeric type. More...
 
bool isInt64 (const std::string &str)
 Check whether a string can be converted to a value of the given numeric type. More...
 
bool isUInt8 (const std::string &str)
 Check whether a string can be converted to a value of the given numeric type. More...
 
bool isUInt16 (const std::string &str)
 Check whether a string can be converted to a value of the given numeric type. More...
 
bool isUInt32 (const std::string &str)
 Check whether a string can be converted to a value of the given numeric type. More...
 
bool isUInt64 (const std::string &str)
 Check whether a string can be converted to a value of the given numeric type. More...
 
bool isFloat (const std::string &str)
 Check whether a string can be converted to a value of the given numeric type. More...
 
bool isDouble (const std::string &str)
 Check whether a string can be converted to a value of the given numeric type. More...
 
bool isBool (const char *str)
 Check whether a string can be converted to a boolean type. More...
 
bool isInt8 (const char *str)
 Check whether a string can be converted to a value of the given numeric type. More...
 
bool isInt16 (const char *str)
 Check whether a string can be converted to a value of the given numeric type. More...
 
bool isInt32 (const char *str)
 Check whether a string can be converted to a value of the given numeric type. More...
 
bool isInt64 (const char *str)
 Check whether a string can be converted to a value of the given numeric type. More...
 
bool isUInt8 (const char *str)
 Check whether a string can be converted to a value of the given numeric type. More...
 
bool isUInt16 (const char *str)
 Check whether a string can be converted to a value of the given numeric type. More...
 
bool isUInt32 (const char *str)
 Check whether a string can be converted to a value of the given numeric type. More...
 
bool isUInt64 (const char *str)
 Check whether a string can be converted to a value of the given numeric type. More...
 
bool isFloat (const char *str)
 Check whether a string can be converted to a value of the given numeric type. More...
 
bool isDouble (const char *str)
 Check whether a string can be converted to a value of the given numeric type. More...
 

Variables

const std::string white_space
 Contains all whitespaces (" \t\n\r")
 
const std::string empty_string
 Contains the empty string.
 

Detailed Description

Serves as component for string handling and conversion functionality.

Function Documentation

◆ compare() [1/3]

int a_util::strings::compare ( const char *  left,
const char *  right 
)

Compares two 0-terminated C-strings.

Parameters
left[in] The left string in the comparison
right[in] The right string in the comparison
Returns
Zero if the strings are identical, < 0 if the left string is less than the right string or a nullptr, or > 0 if the left string is greater than the right string or a nullptr.

Referenced by ddl::access_element::findArrayEndIndex().

◆ compare() [2/3]

int a_util::strings::compare ( const char *  left,
const char *  right,
std::size_t  pos 
)

Compares two 0-terminated C-strings.

Parameters
left[in] The left string in the comparison
right[in] The right string in the comparison
pos[in] Compare from position pos
Returns
Zero if the strings are identical, < 0 if the left string is less than the right string or a nullptr, or > 0 if the left string is greater than the right string or a nullptr.

◆ compare() [3/3]

int a_util::strings::compare ( const char *  left,
const char *  right,
std::size_t  pos,
std::size_t  length 
)

Compares two 0-terminated C-strings.

Parameters
left[in] The left string in the comparison
right[in] The right string in the comparison
pos[in] Compare from position pos
length[in] Compare only length characters
Returns
Zero if the strings are identical, < 0 if the left string is less than the right string or a nullptr, or > 0 if the left string is greater than the right string or a nullptr.

◆ compareNoCase() [1/3]

int a_util::strings::compareNoCase ( const char *  left,
const char *  right 
)

Compares two 0-terminated C-strings, ignoring the case using _tcsicmp.

The generic-text function _tcsicmp, maps to either _stricmp, _wcsicmp, _mbsicmp depending on the character set that is defined at compile time. Each of these functions performs a case-insensitive comparison of the strings, and is not affected by locale.

Parameters
left[in] The left string in the comparison
right[in] The right string in the comparison
Returns
Zero if the strings are identical (ignoring case), < 0 if the left string is less than the right string (ignoring case) or a nullptr, or > 0 if the left string is greater the right string (ignoring case) or a nullptr.

◆ compareNoCase() [2/3]

int a_util::strings::compareNoCase ( const char *  left,
const char *  right,
std::size_t  pos 
)

Compares two 0-terminated C-strings, ignoring the case using _tcsicmp.

The generic-text function _tcsicmp, maps to either _stricmp, _wcsicmp, _mbsicmp depending on the character set that is defined at compile time. Each of these functions performs a case-insensitive comparison of the strings, and is not affected by locale.

Parameters
left[in] The left string in the comparison
right[in] The right string in the comparison
pos[in] Compare from position pos
Returns
Zero if the strings are identical (ignoring case), < 0 if the left string is less than the right string (ignoring case) or a nullptr, or > 0 if the left string is greater the right string (ignoring case) or a nullptr.

◆ compareNoCase() [3/3]

int a_util::strings::compareNoCase ( const char *  left,
const char *  right,
std::size_t  pos,
std::size_t  length 
)

Compares two 0-terminated C-strings, ignoring the case using _tcsicmp.

The generic-text function _tcsicmp, maps to either _stricmp, _wcsicmp, _mbsicmp depending on the character set that is defined at compile time. Each of these functions performs a case-insensitive comparison of the strings, and is not affected by locale.

Parameters
left[in] The left string in the comparison
right[in] The right string in the comparison
pos[in] Compare from position pos
length[in] Compare only length characters
Returns
Zero if the strings are identical (ignoring case), < 0 if the left string is less than the right string (ignoring case) or a nullptr, or > 0 if the left string is greater the right string (ignoring case) or a nullptr.

◆ copy() [1/2]

std::size_t a_util::strings::copy ( char *  dest,
std::size_t  dest_size,
const char *  source 
)

Copies up to dest_size-1 characters from source to dest, ensuring null termination.

Parameters
dest[in] Destination buffer
dest_size[in] Destination buffer size
source[in] Source string (0-terminated)
Returns
Number of characters copied to dest (excluding the null character)
Note
Throws std::invalid_argument if either of the buffer pointers are null!

◆ copy() [2/2]

std::size_t a_util::strings::copy ( char *  dest,
std::size_t  dest_size,
const char *  source,
std::size_t  count 
)

Copies up to count characters from source to dest, ensuring null termination.

Parameters
dest[in] Destination buffer
dest_size[in] Destination buffer size
source[in] Source string (0-terminated)
count[in] Maximum number of characters to copy
Returns
Number of characters copied to dest (excluding the null character)
Note
Throws std::invalid_argument if either of the buffer pointers are null!

◆ format() [1/3]

std::string a_util::strings::format ( const char *  str_format,
  ... 
)

printf()-like formatting of an input string.

Parameters
[in]str_formatThe formatting string.
[in]...vargs to create the formatted string from.
Returns
Formatted string.

◆ format() [2/3]

std::string a_util::strings::format ( std::size_t  initial_buffer_size,
const char *  str_format,
  ... 
)

printf()-like formatting of an input string with a given destination string buffer size.

Parameters
[in]initial_buffer_sizeInitial allocyted size of the string buffer. Always pass size +1 for terminating 0-character.
[in]str_formatThe formatting string.
[in]...vargs to create the formatted string from.
Returns
Formatted string.

◆ format() [3/3]

std::string& a_util::strings::format ( std::string &  buffer,
std::size_t &  pos,
const char *  str_format,
  ... 
)

printf()-like formatting of an input string with a given destination string buffer.

Parameters
[in,out]bufferDestination buffer for the formatted string.
[in,out]posStarting position in the buffer where the formatted string gets written to. After successful execution, gets set to the position of the last written character in the buffer.
[in]str_formatThe formatting string.
[in]...vargs to create the formatted string from.
Returns
Formatted string (input/output parameter buffer).

◆ getLength()

std::size_t a_util::strings::getLength ( const char *  str)

Counts the number of characters in a 0-terminated C-string.

Parameters
str[in] The C-string
Returns
The length of the string or std::string::npos, if str is a nullptr

◆ isBool() [1/2]

bool a_util::strings::isBool ( const char *  str)

Check whether a string can be converted to a boolean type.

Parameters
[in]strThe string to check.
Returns
true if the string can be converted, false otherwise.

◆ isBool() [2/2]

bool a_util::strings::isBool ( const std::string &  str)

Check whether a string can be converted to a boolean type.

Parameters
[in]strThe string to check.
Returns
true if the string can be converted, false otherwise.

◆ isDouble() [1/2]

bool a_util::strings::isDouble ( const char *  str)

Check whether a string can be converted to a value of the given numeric type.

Parameters
[in]strThe string to check.
Returns
true if the string can be converted, false otherwise.

◆ isDouble() [2/2]

bool a_util::strings::isDouble ( const std::string &  str)

Check whether a string can be converted to a value of the given numeric type.

Parameters
[in]strThe string to check.
Returns
true if the string can be converted, false otherwise.

◆ isEmpty()

bool a_util::strings::isEmpty ( const char *  str)

Checks whether a C-style string is empty, meaning nullptr or "".

Parameters
[in]strC-style string to check - must either be nullptr or 0-terminated
Returns
true if empty, false otherwise

◆ isEqual() [1/3]

bool a_util::strings::isEqual ( const char *  left,
const char *  right 
)

Compares two 0-terminated C-strings for equality.

Note
This function is equivalent to Compare(left, right) == 0
Parameters
left[in] The left string in the comparison
right[in] The right string in the comparison
Returns
true if both strings are considered equal, false otherwise

◆ isEqual() [2/3]

bool a_util::strings::isEqual ( const char *  left,
const char *  right,
std::size_t  pos 
)

Compares two 0-terminated C-strings for equality.

Note
This function is equivalent to Compare(left, right) == 0
Parameters
left[in] The left string in the comparison
right[in] The right string in the comparison
pos[in] Compare from position pos
Returns
true if both strings are considered equal, false otherwise

◆ isEqual() [3/3]

bool a_util::strings::isEqual ( const char *  left,
const char *  right,
std::size_t  pos,
std::size_t  length 
)

Compares two 0-terminated C-strings for equality.

Note
This function is equivalent to Compare(left, right) == 0
Parameters
left[in] The left string in the comparison
right[in] The right string in the comparison
pos[in] Compare from position pos
length[in] Compare only length characters
Returns
true if both strings are considered equal, false otherwise

◆ isEqualNoCase() [1/3]

bool a_util::strings::isEqualNoCase ( const char *  left,
const char *  right 
)

Compares two 0-terminated C-strings for equality ignoring their case.

Note
This function is equivalent to compareNoCase(left, right) == 0
Parameters
left[in] The left string in the comparison
right[in] The right string in the comparison
Returns
true if both strings are considered equal, false otherwise

◆ isEqualNoCase() [2/3]

bool a_util::strings::isEqualNoCase ( const char *  left,
const char *  right,
std::size_t  pos 
)

Compares two 0-terminated C-strings for equality ignoring their case.

Note
This function is equivalent to compareNoCase(left, right) == 0
Parameters
left[in] The left string in the comparison
right[in] The right string in the comparison
pos[in] Compare from position pos
Returns
true if both strings are considered equal, false otherwise

◆ isEqualNoCase() [3/3]

bool a_util::strings::isEqualNoCase ( const char *  left,
const char *  right,
std::size_t  pos,
std::size_t  length 
)

Compares two 0-terminated C-strings for equality ignoring their case.

Note
This function is equivalent to compareNoCase(left, right) == 0
Parameters
left[in] The left string in the comparison
right[in] The right string in the comparison
pos[in] Compare from position pos
length[in] Compare only length characters
Returns
true if both strings are considered equal, false otherwise

◆ isFloat() [1/2]

bool a_util::strings::isFloat ( const char *  str)

Check whether a string can be converted to a value of the given numeric type.

Parameters
[in]strThe string to check.
Returns
true if the string can be converted, false otherwise.

◆ isFloat() [2/2]

bool a_util::strings::isFloat ( const std::string &  str)

Check whether a string can be converted to a value of the given numeric type.

Parameters
[in]strThe string to check.
Returns
true if the string can be converted, false otherwise.

◆ isInt16() [1/2]

bool a_util::strings::isInt16 ( const char *  str)

Check whether a string can be converted to a value of the given numeric type.

Parameters
[in]strThe string to check.
Returns
true if the string can be converted, false otherwise.

◆ isInt16() [2/2]

bool a_util::strings::isInt16 ( const std::string &  str)

Check whether a string can be converted to a value of the given numeric type.

Parameters
[in]strThe string to check.
Returns
true if the string can be converted, false otherwise.

◆ isInt32() [1/2]

bool a_util::strings::isInt32 ( const char *  str)

Check whether a string can be converted to a value of the given numeric type.

Parameters
[in]strThe string to check.
Returns
true if the string can be converted, false otherwise.

◆ isInt32() [2/2]

bool a_util::strings::isInt32 ( const std::string &  str)

Check whether a string can be converted to a value of the given numeric type.

Parameters
[in]strThe string to check.
Returns
true if the string can be converted, false otherwise.

◆ isInt64() [1/2]

bool a_util::strings::isInt64 ( const char *  str)

Check whether a string can be converted to a value of the given numeric type.

Parameters
[in]strThe string to check.
Returns
true if the string can be converted, false otherwise.

◆ isInt64() [2/2]

bool a_util::strings::isInt64 ( const std::string &  str)

Check whether a string can be converted to a value of the given numeric type.

Parameters
[in]strThe string to check.
Returns
true if the string can be converted, false otherwise.

◆ isInt8() [1/2]

bool a_util::strings::isInt8 ( const char *  str)

Check whether a string can be converted to a value of the given numeric type.

Parameters
[in]strThe string to check.
Returns
true if the string can be converted, false otherwise.

◆ isInt8() [2/2]

bool a_util::strings::isInt8 ( const std::string &  str)

Check whether a string can be converted to a value of the given numeric type.

Parameters
[in]strThe string to check.
Returns
true if the string can be converted, false otherwise.

◆ isNotEmpty()

bool a_util::strings::isNotEmpty ( const char *  str)

Checks whether a C-style string is not empty, meaning neither nullptr nor "".

Parameters
[in]strC-style string to check - must either be nullptr or 0-terminated
Returns
!isEmpty(str)

◆ isNumeric() [1/2]

bool isNumeric ( const char *  str)

Check whether a string is convertible to a value of type Numeric for generic programming.

Template Parameters
NumericThe numeric type.
Parameters
[in]strThe string to check.
Returns
true if valid numeric value, false otherwise.

Definition at line 23 of file strings_numeric_traits_impl.h.

References IsNumericConvertible::check().

◆ isNumeric() [2/2]

bool isNumeric ( const std::string &  str)

Check whether a string is convertible to a value of type Numeric for generic programming.

Template Parameters
NumericThe numeric type.
Parameters
[in]strThe string to check.
Returns
true if valid numeric value, false otherwise.

Definition at line 29 of file strings_numeric_traits_impl.h.

◆ isUInt16() [1/2]

bool a_util::strings::isUInt16 ( const char *  str)

Check whether a string can be converted to a value of the given numeric type.

Parameters
[in]strThe string to check.
Returns
true if the string can be converted, false otherwise.

◆ isUInt16() [2/2]

bool a_util::strings::isUInt16 ( const std::string &  str)

Check whether a string can be converted to a value of the given numeric type.

Parameters
[in]strThe string to check.
Returns
true if the string can be converted, false otherwise.

◆ isUInt32() [1/2]

bool a_util::strings::isUInt32 ( const char *  str)

Check whether a string can be converted to a value of the given numeric type.

Parameters
[in]strThe string to check.
Returns
true if the string can be converted, false otherwise.

◆ isUInt32() [2/2]

bool a_util::strings::isUInt32 ( const std::string &  str)

Check whether a string can be converted to a value of the given numeric type.

Parameters
[in]strThe string to check.
Returns
true if the string can be converted, false otherwise.

◆ isUInt64() [1/2]

bool a_util::strings::isUInt64 ( const char *  str)

Check whether a string can be converted to a value of the given numeric type.

Parameters
[in]strThe string to check.
Returns
true if the string can be converted, false otherwise.

◆ isUInt64() [2/2]

bool a_util::strings::isUInt64 ( const std::string &  str)

Check whether a string can be converted to a value of the given numeric type.

Parameters
[in]strThe string to check.
Returns
true if the string can be converted, false otherwise.

◆ isUInt8() [1/2]

bool a_util::strings::isUInt8 ( const char *  str)

Check whether a string can be converted to a value of the given numeric type.

Parameters
[in]strThe string to check.
Returns
true if the string can be converted, false otherwise.

◆ isUInt8() [2/2]

bool a_util::strings::isUInt8 ( const std::string &  str)

Check whether a string can be converted to a value of the given numeric type.

Parameters
[in]strThe string to check.
Returns
true if the string can be converted, false otherwise.

◆ join()

std::string a_util::strings::join ( const std::vector< std::string > &  strings,
const std::string &  delimiter 
)

Joins all strings from the vector into one string, separated by the specified delimiter string.

Parameters
[in]stringsThe vector of strings
[in]delimiterThe delimiter string
Returns
Returns the joined string

◆ replace() [1/2]

std::string a_util::strings::replace ( const std::string &  str,
const std::string &  subject,
const std::string &  replacement 
)

Replace all occurences of subject with replacement.

Parameters
[in]strThe string
[in]subjectThe subject string to search for
[in]replacementThe replacement string to substitute
Returns
New string with all replacements done accordingly

◆ replace() [2/2]

std::string& a_util::strings::replace ( std::string &  str,
const std::string &  subject,
const std::string &  replacement 
)

In-place replacement of all occurences of subject with replacement.

Parameters
[in,out]strThe string
[in]subjectThe subject string to search for
[in]replacementThe replacement string to substitute
Returns
Reference to str, after replacement

◆ split() [1/2]

std::vector<std::string> a_util::strings::split ( const std::string &  str,
const std::string &  separator 
)

Splits a string using a specified separator string.

Parameters
str[in] The string
separator[in] The separator string
Returns
A vector of strings containing all split result parts

◆ split() [2/2]

std::vector<std::string> a_util::strings::split ( const std::string &  str,
const std::string &  separator,
bool  keep_empty 
)

Splits a string using a specified separator string.

Parameters
str[in] The string
separator[in] The separator string
keep_empty[in] Flag whether to keep empty parts in the result vector
Returns
A vector of strings containing all split result parts

◆ splitToken() [1/3]

std::vector<std::string> a_util::strings::splitToken ( const std::string &  str)

Splits a string on whitespace characters.

Parameters
str[in] The string
Returns
A vector of strings containing all split result parts

◆ splitToken() [2/3]

std::vector<std::string> a_util::strings::splitToken ( const std::string &  str,
const std::string &  separators 
)

Splits a string using a set of separator characters.

Parameters
str[in] The string
separators[in] The set of separator characters
Returns
A vector of strings containing all split result parts

◆ splitToken() [3/3]

std::vector<std::string> a_util::strings::splitToken ( const std::string &  str,
const std::string &  separators,
bool  keep_empty 
)

Splits a string using a set of separator characters.

Parameters
str[in] The string
separators[in] The set of separator characters
keep_empty[in] Flag whether to keep empty parts in the result vector
Returns
A vector of strings containing all split result parts

◆ toBool() [1/4]

bool a_util::strings::toBool ( const char *  from)

Convert a string to a boolean value.

Parameters
[in]fromString to convert. If either "true" or "false" (case insensitive), evaluates to the corresponding boolean value. If numeric, implicit conversion rules apply.
Returns
Boolean representation of input string.

◆ toBool() [2/4]

bool a_util::strings::toBool ( const char *  from,
bool &  to 
)

Safely convert a string to a boolean value.

Parameters
[in]fromString to convert. If either "true" or "false" (case insensitive), evaluates to the corresponding boolean value. If numeric, implicit conversion rules apply.
[out]toBoolean value converted from the string representation.
Return values
trueConversion was successful, to contains the converted value.
falseConversion failed, to is left untouched.

◆ toBool() [3/4]

bool a_util::strings::toBool ( const std::string &  from)

Convert a string to a boolean value.

Parameters
[in]fromString to convert. If either "true" or "false" (case insensitive), evaluates to the corresponding boolean value. If numeric, implicit conversion rules apply.
Returns
Boolean representation of input string.

◆ toBool() [4/4]

bool a_util::strings::toBool ( const std::string &  from,
bool &  to 
)

Safely convert a string to a boolean value.

Parameters
[in]fromString to convert. If either "true" or "false" (case insensitive), evaluates to the corresponding boolean value. If numeric, implicit conversion rules apply.
[out]toBoolean value converted from the string representation.
Return values
trueConversion was successful, to contains the converted value.
falseConversion failed, to is left untouched.

◆ toDouble() [1/4]

double a_util::strings::toDouble ( const char *  from)

Convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of the return type numeric limits, the conversion fails.
Returns
Numeric value, 0 if out of range of return types numeric limits.

◆ toDouble() [2/4]

bool a_util::strings::toDouble ( const char *  from,
double &  to 
)

Safely convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of decltype(to) numeric limits, the conversion fails.
[out]toNumeric value converted from the string representation.
Return values
trueConversion was successful, to contains the converted value.
falseConversion failed, to is left untouched.

◆ toDouble() [3/4]

double a_util::strings::toDouble ( const std::string &  from)

Convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of the return type numeric limits, the conversion fails.
Returns
Numeric value, 0 if out of range of return types numeric limits.

◆ toDouble() [4/4]

bool a_util::strings::toDouble ( const std::string &  from,
double &  to 
)

Safely convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of decltype(to) numeric limits, the conversion fails.
[out]toNumeric value converted from the string representation.
Return values
trueConversion was successful, to contains the converted value.
falseConversion failed, to is left untouched.

◆ toFloat() [1/4]

float a_util::strings::toFloat ( const char *  from)

Convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of the return type numeric limits, the conversion fails.
Returns
Numeric value, 0 if out of range of return types numeric limits.

◆ toFloat() [2/4]

bool a_util::strings::toFloat ( const char *  from,
float &  to 
)

Safely convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of decltype(to) numeric limits, the conversion fails.
[out]toNumeric value converted from the string representation.
Return values
trueConversion was successful, to contains the converted value.
falseConversion failed, to is left untouched.

◆ toFloat() [3/4]

float a_util::strings::toFloat ( const std::string &  from)

Convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of the return type numeric limits, the conversion fails.
Returns
Numeric value, 0 if out of range of return types numeric limits.

◆ toFloat() [4/4]

bool a_util::strings::toFloat ( const std::string &  from,
float &  to 
)

Safely convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of decltype(to) numeric limits, the conversion fails.
[out]toNumeric value converted from the string representation.
Return values
trueConversion was successful, to contains the converted value.
falseConversion failed, to is left untouched.

◆ toInt16() [1/4]

std::int16_t a_util::strings::toInt16 ( const char *  from)

Convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of the return type numeric limits, the conversion fails.
Returns
Numeric value, 0 if out of range of return types numeric limits.

◆ toInt16() [2/4]

bool a_util::strings::toInt16 ( const char *  from,
std::int16_t &  to 
)

Safely convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of decltype(to) numeric limits, the conversion fails.
[out]toNumeric value converted from the string representation.
Return values
trueConversion was successful, to contains the converted value.
falseConversion failed, to is left untouched.

◆ toInt16() [3/4]

std::int16_t a_util::strings::toInt16 ( const std::string &  from)

Convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of the return type numeric limits, the conversion fails.
Returns
Numeric value, 0 if out of range of return types numeric limits.

◆ toInt16() [4/4]

bool a_util::strings::toInt16 ( const std::string &  from,
std::int16_t &  to 
)

Safely convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of decltype(to) numeric limits, the conversion fails.
[out]toNumeric value converted from the string representation.
Return values
trueConversion was successful, to contains the converted value.
falseConversion failed, to is left untouched.

◆ toInt32() [1/4]

std::int32_t a_util::strings::toInt32 ( const char *  from)

Convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of the return type numeric limits, the conversion fails.
Returns
Numeric value, 0 if out of range of return types numeric limits.

◆ toInt32() [2/4]

bool a_util::strings::toInt32 ( const char *  from,
std::int32_t &  to 
)

Safely convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of decltype(to) numeric limits, the conversion fails.
[out]toNumeric value converted from the string representation.
Return values
trueConversion was successful, to contains the converted value.
falseConversion failed, to is left untouched.

◆ toInt32() [3/4]

std::int32_t a_util::strings::toInt32 ( const std::string &  from)

Convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of the return type numeric limits, the conversion fails.
Returns
Numeric value, 0 if out of range of return types numeric limits.

◆ toInt32() [4/4]

bool a_util::strings::toInt32 ( const std::string &  from,
std::int32_t &  to 
)

Safely convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of decltype(to) numeric limits, the conversion fails.
[out]toNumeric value converted from the string representation.
Return values
trueConversion was successful, to contains the converted value.
falseConversion failed, to is left untouched.

◆ toInt64() [1/4]

std::int64_t a_util::strings::toInt64 ( const char *  from)

Convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of the return type numeric limits, the conversion fails.
Returns
Numeric value, 0 if out of range of return types numeric limits.

◆ toInt64() [2/4]

bool a_util::strings::toInt64 ( const char *  from,
std::int64_t &  to 
)

Safely convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of decltype(to) numeric limits, the conversion fails.
[out]toNumeric value converted from the string representation.
Return values
trueConversion was successful, to contains the converted value.
falseConversion failed, to is left untouched.

◆ toInt64() [3/4]

std::int64_t a_util::strings::toInt64 ( const std::string &  from)

Convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of the return type numeric limits, the conversion fails.
Returns
Numeric value, 0 if out of range of return types numeric limits.

◆ toInt64() [4/4]

bool a_util::strings::toInt64 ( const std::string &  from,
std::int64_t &  to 
)

Safely convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of decltype(to) numeric limits, the conversion fails.
[out]toNumeric value converted from the string representation.
Return values
trueConversion was successful, to contains the converted value.
falseConversion failed, to is left untouched.

◆ toInt8() [1/4]

std::int8_t a_util::strings::toInt8 ( const char *  from)

Convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of the return type numeric limits, the conversion fails.
Returns
Numeric value, 0 if out of range of return types numeric limits.

◆ toInt8() [2/4]

bool a_util::strings::toInt8 ( const char *  from,
std::int8_t &  to 
)

Safely convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of decltype(to) numeric limits, the conversion fails.
[out]toNumeric value converted from the string representation.
Return values
trueConversion was successful, to contains the converted value.
falseConversion failed, to is left untouched.

◆ toInt8() [3/4]

std::int8_t a_util::strings::toInt8 ( const std::string &  from)

Convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of the return type numeric limits, the conversion fails.
Returns
Numeric value, 0 if out of range of return types numeric limits.

◆ toInt8() [4/4]

bool a_util::strings::toInt8 ( const std::string &  from,
std::int8_t &  to 
)

Safely convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of decltype(to) numeric limits, the conversion fails.
[out]toNumeric value converted from the string representation.
Return values
trueConversion was successful, to contains the converted value.
falseConversion failed, to is left untouched.

◆ toNumeric() [1/4]

Numeric toNumeric ( const char *  from)

Convert a string to a numeric value in a generic manner.

Template Parameters
NumericThe numeric type the string gets converted to.
Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of the return type numeric limits, the conversion fails.
Returns
Numeric value, 0 if out of range of return types numeric limits.

Definition at line 35 of file strings_convert_impl.h.

References ToNumericConverter::convert().

◆ toNumeric() [2/4]

bool toNumeric ( const char *  from,
Numeric &  to 
)

Safely convert a string to a value of type Numeric in a generic manner.

Template Parameters
NumericThe numeric type the string gets converted to.
Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of decltype(to) numeric limits, the conversion fails.
[out]toNumeric value converted from the string representation.
Return values
trueConversion was successful, to contains the converted value.
falseConversion failed, to is left untouched.

Definition at line 23 of file strings_convert_impl.h.

References ToNumericConverter::convert().

◆ toNumeric() [3/4]

Numeric toNumeric ( const std::string &  from)

Convert a string to a numeric value in a generic manner.

Template Parameters
NumericThe numeric type the string gets converted to.
Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of the return type numeric limits, the conversion fails.
Returns
Numeric value, 0 if out of range of return types numeric limits.

Definition at line 43 of file strings_convert_impl.h.

References ToNumericConverter::convert().

◆ toNumeric() [4/4]

bool toNumeric ( const std::string &  from,
Numeric &  to 
)

Safely convert a string to a value of type Numeric in a generic manner.

Template Parameters
NumericThe numeric type the string gets converted to.
Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of decltype(to) numeric limits, the conversion fails.
[out]toNumeric value converted from the string representation.
Return values
trueConversion was successful, to contains the converted value.
falseConversion failed, to is left untouched.

Definition at line 29 of file strings_convert_impl.h.

References ToNumericConverter::convert().

◆ toString() [1/11]

std::string a_util::strings::toString ( bool  from)

Convert the boolean value to its string representation.

Parameters
[in]fromThe value converted to its string representation.
Returns
"true" or "false", according to the input parameter

◆ toString() [2/11]

std::string a_util::strings::toString ( double  from)

Convert the given value to a standard string.

Parameters
[in]fromThe value converted to its string representation.
Returns
String representation of the input parameter

◆ toString() [3/11]

std::string a_util::strings::toString ( float  from)

Convert the given value to a standard string.

Parameters
[in]fromThe value converted to its string representation.
Returns
String representation of the input parameter

◆ toString() [4/11]

std::string a_util::strings::toString ( std::int16_t  from)

Convert the given value to a standard string.

Parameters
[in]fromThe value converted to its string representation.
Returns
String representation of the input parameter

◆ toString() [5/11]

std::string a_util::strings::toString ( std::int32_t  from)

Convert the given value to a standard string.

Parameters
[in]fromThe value converted to its string representation.
Returns
String representation of the input parameter

◆ toString() [6/11]

std::string a_util::strings::toString ( std::int64_t  from)

Convert the given value to a standard string.

Parameters
[in]fromThe value converted to its string representation.
Returns
String representation of the input parameter

◆ toString() [7/11]

std::string a_util::strings::toString ( std::int8_t  from)

Convert the given value to a standard string.

Parameters
[in]fromThe value converted to its string representation.
Returns
String representation of the input parameter

◆ toString() [8/11]

std::string a_util::strings::toString ( std::uint16_t  from)

Convert the given value to a standard string.

Parameters
[in]fromThe value converted to its string representation.
Returns
String representation of the input parameter

◆ toString() [9/11]

std::string a_util::strings::toString ( std::uint32_t  from)

Convert the given value to a standard string.

Parameters
[in]fromThe value converted to its string representation.
Returns
String representation of the input parameter

◆ toString() [10/11]

std::string a_util::strings::toString ( std::uint64_t  from)

Convert the given value to a standard string.

Parameters
[in]fromThe value converted to its string representation.
Returns
String representation of the input parameter

◆ toString() [11/11]

std::string a_util::strings::toString ( std::uint8_t  from)

Convert the given value to a standard string.

Parameters
[in]fromThe value converted to its string representation.
Returns
String representation of the input parameter

◆ toUInt16() [1/4]

std::uint16_t a_util::strings::toUInt16 ( const char *  from)

Convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of the return type numeric limits, the conversion fails.
Returns
Numeric value, 0 if out of range of return types numeric limits.

◆ toUInt16() [2/4]

bool a_util::strings::toUInt16 ( const char *  from,
std::uint16_t &  to 
)

Safely convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of decltype(to) numeric limits, the conversion fails.
[out]toNumeric value converted from the string representation.
Return values
trueConversion was successful, to contains the converted value.
falseConversion failed, to is left untouched.

◆ toUInt16() [3/4]

std::uint16_t a_util::strings::toUInt16 ( const std::string &  from)

Convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of the return type numeric limits, the conversion fails.
Returns
Numeric value, 0 if out of range of return types numeric limits.

◆ toUInt16() [4/4]

bool a_util::strings::toUInt16 ( const std::string &  from,
std::uint16_t &  to 
)

Safely convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of decltype(to) numeric limits, the conversion fails.
[out]toNumeric value converted from the string representation.
Return values
trueConversion was successful, to contains the converted value.
falseConversion failed, to is left untouched.

◆ toUInt32() [1/4]

std::uint32_t a_util::strings::toUInt32 ( const char *  from)

Convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of the return type numeric limits, the conversion fails.
Returns
Numeric value, 0 if out of range of return types numeric limits.

◆ toUInt32() [2/4]

bool a_util::strings::toUInt32 ( const char *  from,
std::uint32_t &  to 
)

Safely convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of decltype(to) numeric limits, the conversion fails.
[out]toNumeric value converted from the string representation.
Return values
trueConversion was successful, to contains the converted value.
falseConversion failed, to is left untouched.

◆ toUInt32() [3/4]

std::uint32_t a_util::strings::toUInt32 ( const std::string &  from)

Convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of the return type numeric limits, the conversion fails.
Returns
Numeric value, 0 if out of range of return types numeric limits.

◆ toUInt32() [4/4]

bool a_util::strings::toUInt32 ( const std::string &  from,
std::uint32_t &  to 
)

Safely convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of decltype(to) numeric limits, the conversion fails.
[out]toNumeric value converted from the string representation.
Return values
trueConversion was successful, to contains the converted value.
falseConversion failed, to is left untouched.

◆ toUInt64() [1/4]

std::uint64_t a_util::strings::toUInt64 ( const char *  from)

Convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of the return type numeric limits, the conversion fails.
Returns
Numeric value, 0 if out of range of return types numeric limits.

◆ toUInt64() [2/4]

bool a_util::strings::toUInt64 ( const char *  from,
std::uint64_t &  to 
)

Safely convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of decltype(to) numeric limits, the conversion fails.
[out]toNumeric value converted from the string representation.
Return values
trueConversion was successful, to contains the converted value.
falseConversion failed, to is left untouched.

◆ toUInt64() [3/4]

std::uint64_t a_util::strings::toUInt64 ( const std::string &  from)

Convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of the return type numeric limits, the conversion fails.
Returns
Numeric value, 0 if out of range of return types numeric limits.

◆ toUInt64() [4/4]

bool a_util::strings::toUInt64 ( const std::string &  from,
std::uint64_t &  to 
)

Safely convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of decltype(to) numeric limits, the conversion fails.
[out]toNumeric value converted from the string representation.
Return values
trueConversion was successful, to contains the converted value.
falseConversion failed, to is left untouched.

◆ toUInt8() [1/4]

std::uint8_t a_util::strings::toUInt8 ( const char *  from)

Convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of the return type numeric limits, the conversion fails.
Returns
Numeric value, 0 if out of range of return types numeric limits.

◆ toUInt8() [2/4]

bool a_util::strings::toUInt8 ( const char *  from,
std::uint8_t &  to 
)

Safely convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of decltype(to) numeric limits, the conversion fails.
[out]toNumeric value converted from the string representation.
Return values
trueConversion was successful, to contains the converted value.
falseConversion failed, to is left untouched.

◆ toUInt8() [3/4]

std::uint8_t a_util::strings::toUInt8 ( const std::string &  from)

Convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of the return type numeric limits, the conversion fails.
Returns
Numeric value, 0 if out of range of return types numeric limits.

◆ toUInt8() [4/4]

bool a_util::strings::toUInt8 ( const std::string &  from,
std::uint8_t &  to 
)

Safely convert a string to a numeric value.

Parameters
[in]fromString to convert. If the potentially convertible numeric value is not in range of decltype(to) numeric limits, the conversion fails.
[out]toNumeric value converted from the string representation.
Return values
trueConversion was successful, to contains the converted value.
falseConversion failed, to is left untouched.

◆ trim() [1/2]

std::string& a_util::strings::trim ( std::string &  str)

Trims all whitespace characters from the start and end of a string.

Parameters
str[inout] The string that is trimmed
Returns
Returns str, trimmed as specified

◆ trim() [2/2]

std::string& a_util::strings::trim ( std::string &  str,
const std::string &  trimmed_chars 
)

Trims a specified set of characters from the start and end of a string.

Parameters
str[inout] The string that is trimmed
trimmed_chars[in] The set of characters to trim
Returns
Returns str, trimmed as specified