|
| static double | toDouble (const std::string &str) |
| | Converts a string to a double.
|
| |
| static double | toInt (const std::string &str) |
| | Converts a string to an integer.
|
| |
| template<size_t N> |
| static std::array< int, N > | toIntArray (const std::string &str) |
| | Converts a string into an integer array.
|
| |
| template<size_t N> |
| static std::array< double, N > | toDoubleArray (const std::string &str, bool reqBrackets=true) |
| | Converts a string into a double array.
|
| |
| static WriterType | toWriterType (const std::string &type) |
| | Converts a string to a WriterType enum using a dedicated map.
|
| |
| static SimulationType | toSimulationType (const std::string &type) |
| | Converts a string to a SimulationType enum using a dedicated map.
|
| |
| static ParallelizationType | toParallelizationType (const std::string &type) |
| | Converts a string to a ParallelizationType enum using a dedicated map.
|
| |
| static std::string | fromChar (char c) |
| | Converts a char to a string.
|
| |
| static std::string | fromWriterType (WriterType writerType) |
| | Converts a WriterType to a string.
|
| |
| static std::string | fromSimulationType (SimulationType simulationType) |
| | Converts a SimulationType to a string.
|
| |
| static std::string | fromParallelizationType (ParallelizationType parallelizationType) |
| | Converts a ParallelizationType to a string.
|
| |
| template<typename T > |
| static std::string | fromNumber (T number) |
| | Converts a number to a string.
|
| |
| template<typename T > |
| static std::string | fromVector (const std::vector< T > &vec) |
| | Converts a vector to a string.
|
| |
Namespace defining utility functions for working with strings.
template<size_t N>
| static std::array< double, N > StringUtils::toDoubleArray |
( |
const std::string & |
str, |
|
|
bool |
reqBrackets = true |
|
) |
| |
|
inlinestatic |
Converts a string into a double array.
The string must be of the format "{_, _, ..., _}" (excluding quotes) and contain exactly as many elements as specified. If the string is empty, however, an empty array will always be returned. If the provided length of array is longer than the amount of elements read, the remaining array slots will be filled with zeroes. If the provided length of the array is shorter than the amount of elements read, the array will be truncated.
Each number may have an arbitrary amount of leading whitespaces. Trailing whitespaces are not allowed.
- Template Parameters
-
| N | The length of the array. |
- Parameters
-
| str | The string to be converted, should be formatted as comma-separated decimal numbers between curly braces. |
| reqBrackets | If specified, the array must be enclosed by curly brackets. Otherwise, the format is simply "_, _,
..., _". |
- Returns
- The corresponding array of doubles.
template<size_t N>
| static std::array< int, N > StringUtils::toIntArray |
( |
const std::string & |
str | ) |
|
|
inlinestatic |
Converts a string into an integer array.
The string must be of the format "{_, _, ..., _}" (excluding quotes) and contain exactly as many elements as specified. If the string is empty, however, an empty array will always be returned. If the provided length of array is longer than the amount of elements read, the remaining array slots will be filled with zeroes. If the provided length of the array is shorter than the amount of elements read, the array will be truncated.
Each number may have an arbitrary amount of leading whitespaces. Trailing whitespaces are not allowed.
- Template Parameters
-
| N | The length of the array. |
- Parameters
-
| str | The string to be converted, should be formatted as comma-separated integers between curly braces. |
- Returns
- The corresponding array of integers.