|
MolSim
|
Utility functions for working with strings. More...
#include "Arguments.h"#include "CLIUtils.h"#include <algorithm>#include <cctype>#include <iostream>#include <sstream>#include <stdexcept>#include <string>#include <unordered_map>#include <vector>Go to the source code of this file.
Namespaces | |
| namespace | StringUtils |
| Namespace defining utility functions for working with strings. | |
Functions | |
| static bool | findStringIC (const std::string &haystack, const std::string &needle) |
| Finds a given substring in a string. Case-insensitive. | |
| static double | StringUtils::toDouble (const std::string &str) |
| Converts a string to a double. | |
| static double | StringUtils::toInt (const std::string &str) |
| Converts a string to an integer. | |
| template<size_t N> | |
| static std::array< int, N > | StringUtils::toIntArray (const std::string &str) |
| Converts a string into an integer array. | |
| template<size_t N> | |
| static std::array< double, N > | StringUtils::toDoubleArray (const std::string &str, bool reqBrackets=true) |
| Converts a string into a double array. | |
| static WriterType | StringUtils::toWriterType (const std::string &type) |
| Converts a string to a WriterType enum using a dedicated map. | |
| static SimulationType | StringUtils::toSimulationType (const std::string &type) |
| Converts a string to a SimulationType enum using a dedicated map. | |
| static ParallelizationType | StringUtils::toParallelizationType (const std::string &type) |
| Converts a string to a ParallelizationType enum using a dedicated map. | |
| static std::string | StringUtils::fromChar (char c) |
| Converts a char to a string. | |
| static std::string | StringUtils::fromWriterType (WriterType writerType) |
| Converts a WriterType to a string. | |
| static std::string | StringUtils::fromSimulationType (SimulationType simulationType) |
| Converts a SimulationType to a string. | |
| static std::string | StringUtils::fromParallelizationType (ParallelizationType parallelizationType) |
| Converts a ParallelizationType to a string. | |
| template<typename T > | |
| static std::string | StringUtils::fromNumber (T number) |
| Converts a number to a string. | |
| template<typename T > | |
| static std::string | StringUtils::fromVector (const std::vector< T > &vec) |
| Converts a vector to a string. | |
Variables | |
| static const std::unordered_map< std::string, WriterType > | writerTable |
| Map containing conversion information for converting a string to a WriterType enum. | |
| static const std::unordered_map< std::string, SimulationType > | simulationTable |
| Map containing conversion information for converting a string to a SimulationType enum. | |
| static const std::unordered_map< std::string, ParallelizationType > | parallelizationTable |
| Map containing conversion information for converting a string to a ParallelizationType enum. | |
| static const std::unordered_map< WriterType, std::string > | writerStringTable |
| Reverse map containing conversion information for converting a WriterType enum to a string. | |
| static const std::unordered_map< SimulationType, std::string > | simulationStringTable |
| Reverse map containing conversion information for converting a SimulationType enum to a string. | |
| static const std::unordered_map< ParallelizationType, std::string > | parallelizationStringTable |
| Reverse map containing conversion information for converting a ParallelizationType enum to a string. | |
Utility functions for working with strings.
|
inlinestatic |
Finds a given substring in a string. Case-insensitive.
Source: https://stackoverflow.com/a/19839371
| haystack | The string which may or may not contain the substring. |
| needle | The substring to search for in the string. |
|
inlinestatic |
Reverse map containing conversion information for converting a ParallelizationType enum to a string.
|
inlinestatic |
Map containing conversion information for converting a string to a ParallelizationType enum.
|
inlinestatic |
Reverse map containing conversion information for converting a SimulationType enum to a string.
|
inlinestatic |
Map containing conversion information for converting a string to a SimulationType enum.
|
inlinestatic |
Reverse map containing conversion information for converting a WriterType enum to a string.
|
inlinestatic |
Map containing conversion information for converting a string to a WriterType enum.