Utilities for data structures.
More...
|
std::string | trimString (const std::string &str) noexcept |
| Removes leading and trailing whitespace from a string.
|
|
std::vector< std::string > | splitString (const std::string &input, char delimiter, bool trim=true) noexcept |
| Splits a string into a vector of substrings based on a delimiter.
|
|
template<class T > |
void | removeDuplicates (std::vector< T > &vec) noexcept |
| Removes duplicate elements from a vector in place.
|
|
Utilities for data structures.
◆ trimString()
std::string trimString |
( |
const std::string & |
str | ) |
|
|
inlinenoexcept |
Removes leading and trailing whitespace from a string.
- Parameters
-
str | The input string to be trimmed. |
- Returns
- A new string with leading and trailing spaces removed.
◆ splitString()
std::vector< std::string > splitString |
( |
const std::string & |
input, |
|
|
char |
delimiter, |
|
|
bool |
trim = true |
|
) |
| |
|
noexcept |
Splits a string into a vector of substrings based on a delimiter.
- Parameters
-
input | The string to split. |
delimiter | The character used to split the string. |
trim | If true , removes leading and trailing spaces from each substring. |
- Returns
- A vector of strings resulting from the split operation.
◆ removeDuplicates()
template<class T >
void removeDuplicates |
( |
std::vector< T > & |
vec | ) |
|
|
inlinenoexcept |
Removes duplicate elements from a vector in place.
- Template Parameters
-
T | The type of elements in the vector. |
- Parameters
-
vec | The vector from which duplicates will be removed. |