GEOS
|
Go to the source code of this file.
Namespaces | |
geos | |
Functions | |
string | geos::stringutilities::toLower (string const &input) |
Return a copy of the string in lower case. More... | |
template<typename IT , typename S = char> | |
string | geos::stringutilities::join (IT first, IT last, S const &delim=S()) |
Join strings or other printable objects with a delimiter. More... | |
template<typename CONTAINER , typename S = char> | |
string | geos::stringutilities::join (CONTAINER const &container, S const &delim=S()) |
Join strings or other printable objects with a delimiter. More... | |
template<typename IT , typename S , typename LAMBDA > | |
string | geos::stringutilities::joinLamda (IT first, IT last, S const &delim, LAMBDA formattingFunc) |
Join strings or other printable objects returned by a formatter functor. More... | |
template<typename CONTAINER , typename S , typename LAMBDA > | |
string | geos::stringutilities::joinLamda (CONTAINER const &container, S const &delim, LAMBDA formattingFunc) |
Join strings or other printable objects returned by a formatter functor. More... | |
template<typename S = char, typename T , typename ... Ts> | |
string | geos::stringutilities::concat (S const &delim, T const &v, Ts const &... vs) |
Concatenate variadic arguments into a string with a delimiter. More... | |
template<template< class ... > class CONTAINER = std::vector> | |
CONTAINER< string > | geos::stringutilities::tokenize (string const &str, string const &delimiters, bool const treatConsecutiveDelimAsOne=true, bool const preTrimStr=false) |
Subdivide the string in substrings by the specified delimiters. More... | |
template<template< class ... > class CONTAINER = std::vector> | |
CONTAINER< string > | geos::stringutilities::tokenizeBySpaces (string const &str) |
Subdivide the string in substrings by whitespaces separators (see std::isspace()). Do not create any empty substrings. More... | |
string_view | geos::stringutilities::trim (string_view str, string_view charsToRemove) |
Trim the string. More... | |
string_view | geos::stringutilities::trimSpaces (string_view str) |
Trim the string so it does not starts nor ends with any whitespaces. More... | |
string | geos::stringutilities::removeStringAndFollowingContent (string_view str, string_view strToRemove) |
Search for a string in the line, and return the line truncated before the string. More... | |
template<typename T > | |
string | geos::stringutilities::addCommaSeparators (T const &num) |
Add comma separators to an integral number for readability. More... | |
template<typename T > | |
array1d< T > | geos::stringutilities::fromStringToArray (string const &str) |
Take a string, and return a array1d with the cast values. More... | |
template<typename T > | |
string | geos::stringutilities::toMetricPrefixString (T const &value) |
Take a numerical value and convert/scale it to a string with a metric prefix. i.e. Kilo, Mega, Giga, Tera, Peta, Exa. More... | |
constexpr size_t | geos::stringutilities::cstrlen (char const *const str) |
constexpr bool | geos::stringutilities::startsWith (std::string_view str, std::string_view prefix) |
constexpr bool | geos::stringutilities::endsWith (std::string_view str, std::string_view suffix) |
template<typename T > | |
std::ostream & | geos::stringutilities::operator<< (std::ostream &os, std::optional< T > const &optValue) |
Overloading operator (<<) for std::optional<T>. More... | |
string geos::stringutilities::addCommaSeparators | ( | T const & | num | ) |
Add comma separators to an integral number for readability.
T | the integral type of the number to format. |
[in] | num | the integral number to format. |
string geos::stringutilities::concat | ( | S const & | delim, |
T const & | v, | ||
Ts const &... | vs | ||
) |
Concatenate variadic arguments into a string with a delimiter.
S | type of delimiter (printable to std::ostringstream) |
T | type of first argument (printable to std::ostringstream) |
Ts | types of remaining arguments (printable to std::ostringstream) |
delim | delimiter |
v | first value |
vs | remaining values |
Definition at line 133 of file StringUtilities.hpp.
|
constexpr |
str | The null-character terminated constant string |
Definition at line 275 of file StringUtilities.hpp.
|
constexpr |
str | The string to compare |
suffix | A suffix we want to know if the string ends with. |
Definition at line 306 of file StringUtilities.hpp.
array1d< T > geos::stringutilities::fromStringToArray | ( | string const & | str | ) |
Take a string, and return a array1d with the cast values.
T | the type to which the string will be cast |
[in] | str | the string to turn into an array1d |
Definition at line 246 of file StringUtilities.hpp.
string geos::stringutilities::join | ( | CONTAINER const & | container, |
S const & | delim = S() |
||
) |
Join strings or other printable objects with a delimiter.
CONTAINER | type of container to join |
S | the type of delimiter, usually char, char const * or string |
container | the container to join |
delim | delimiter used to glue together strings |
Definition at line 74 of file StringUtilities.hpp.
string geos::stringutilities::join | ( | IT | first, |
IT | last, | ||
S const & | delim = S() |
||
) |
Join strings or other printable objects with a delimiter.
IT | type of iterator into the range of objects to join |
S | type of delimiter, usually char, char const * or string |
first | iterator to start of the range |
last | iterator past-the-end of the range |
delim | delimiter used to glue together strings |
Definition at line 50 of file StringUtilities.hpp.
string geos::stringutilities::joinLamda | ( | CONTAINER const & | container, |
S const & | delim, | ||
LAMBDA | formattingFunc | ||
) |
Join strings or other printable objects returned by a formatter functor.
CONTAINER | type of container to join |
S | type of delimiter, usually char, char const * or string |
LAMBDA | type of formatter functor, usually []( auto it ) -> string |
formattingFunc | formatter function to get a formattable value from an iterator of the container |
container | container to join |
delim | delimiter used to glue together strings |
Definition at line 117 of file StringUtilities.hpp.
string geos::stringutilities::joinLamda | ( | IT | first, |
IT | last, | ||
S const & | delim, | ||
LAMBDA | formattingFunc | ||
) |
Join strings or other printable objects returned by a formatter functor.
IT | type of iterator into the range of objects to join |
S | type of delimiter, usually char, char const * or string |
LAMBDA | type of formatter functor, usually []( auto it ) -> string |
formattingFunc | formatter function to get a formattable value from a IT iterator |
first | iterator to start of the range |
last | iterator past-the-end of the range |
delim | delimiter used to glue together strings |
Definition at line 91 of file StringUtilities.hpp.
std::ostream& geos::stringutilities::operator<< | ( | std::ostream & | os, |
std::optional< T > const & | optValue | ||
) |
Overloading operator (<<) for std::optional<T>.
This function displays the value contained in a std::optional<T> object if one exists. Otherwise, it produces no output.
T | The type of the value contained std::optional. |
os | An output stream (for example, std::cout). |
optValue | std::optional<T> value to display. |
Definition at line 324 of file StringUtilities.hpp.
string geos::stringutilities::removeStringAndFollowingContent | ( | string_view | str, |
string_view | strToRemove | ||
) |
Search for a string in the line, and return the line truncated before the string.
[in] | str | the line to truncate |
[in] | strToRemove | the string to search for in the line |
|
constexpr |
str | The string to compare |
prefix | A prefix we want to know if the string starts with. |
Definition at line 295 of file StringUtilities.hpp.
CONTAINER< string > geos::stringutilities::tokenize | ( | string const & | str, |
string const & | delimiters, | ||
bool const | treatConsecutiveDelimAsOne = true , |
||
bool const | preTrimStr = false |
||
) |
Subdivide the string in substrings by the specified delimiters.
CONTAINER | The templated class of the results container (std::vector by default). |
str | The string to subdivide. |
delimiters | String that contains the list of possible delimiters. |
treatConsecutiveDelimAsOne | If enabled, consecutive delimiters will be treated as one. If not enabled, consecutive delimiters will result in empty entries. |
preTrimStr | If enabled, delimiters at the borders of the string will be ignored. If not enabled, those delimiters will result in in empty entries. |
Definition at line 155 of file StringUtilities.hpp.
CONTAINER< string > geos::stringutilities::tokenizeBySpaces | ( | string const & | str | ) |
Subdivide the string in substrings by whitespaces separators (see std::isspace()). Do not create any empty substrings.
CONTAINER | The templated class of the results container (std::vector by default). |
str | The string to subdivide. |
Definition at line 200 of file StringUtilities.hpp.
string geos::stringutilities::toLower | ( | string const & | input | ) |
Return a copy of the string in lower case.
input | The input string which is not modified. |
string geos::stringutilities::toMetricPrefixString | ( | T const & | value | ) |
Take a numerical value and convert/scale it to a string with a metric prefix. i.e. Kilo, Mega, Giga, Tera, Peta, Exa.
T | Type of the value to be converted |
value | The value to be converted |
string_view geos::stringutilities::trim | ( | string_view | str, |
string_view | charsToRemove | ||
) |
Trim the string.
[in] | str | the string to trim |
[in] | charsToRemove | the list of characters to remove |
string_view geos::stringutilities::trimSpaces | ( | string_view | str | ) |
Trim the string so it does not starts nor ends with any whitespaces.
[in] | str | the string to trim |