Some functions to parse enums from (input-) strings. More...
Functions | |
std::string | matchStrings (const std::vector< std::string > &haystack, std::string needle) |
Finds best match of needle in haystack. | |
std::vector< std::string > | tokenize (const std::string &searchString, const std::string &delimiters) |
Splits a string by multiple delimiters. | |
std::array< double, 3 > | parseArrayD3 (const std::string &string) |
Converts a string to std::array<double,3>. | |
bool | parseBoolOption (const std::string &booleanOption) |
Converts a string to bool. | |
std::set< double > | parseDoubles (const std::string &doubleString) |
Converts a string to a set of doubles. | |
std::unique_ptr< autopas::NumberSet< double > > | parseNumberSet (const std::string &setString) |
Converts a string to a NumberSet<double>. | |
Variables | |
constexpr char | delimiters [] = " ,;|/" |
All accepted delimiters to split input strings. | |
constexpr char | delimitersRgx [] = "[\\s,;|/]" |
Regex for all delimiters to split input strings. | |
constexpr char | delimitersRgxInv [] = "[^\\s,;|/]" |
Regex for all but delimiters to split input strings as regex. | |
static const std::string | regexDoubleStr |
Regex for a double e.g. | |
Some functions to parse enums from (input-) strings.
|
inline |
Finds best match of needle in haystack.
Needle is compared to every option in haystack and the Needleman-Wunsch score calculated. If the result is ambiguous an exception is thrown.
haystack | Vector of string to match to. |
needle |
|
inline |
Converts a string to std::array<double,3>.
Allowed delimiters can be found in autopas::utils::StringUtils::delimiters.
String format: 3 doubles(or ints) separated by delimiters (examples: 10.,10.,10.)
string | String to parse. |
|
inline |
Converts a string to bool.
String format: on || off || enabled || disabled || true || false
booleanOption |
|
inline |
Converts a string to a set of doubles.
doubleString | String containing doubles. |
|
inline |
Converts a string to a NumberSet<double>.
setString | String containing the set. |
|
inline |
Splits a string by multiple delimiters.
searchString | |
delimiters |
|
static |
Regex for a double e.g.
1 | 1.2 | 1.2e-3