15 #ifndef BORNAGAIN_MVVM_MODEL_MVVM_UTILS_STRINGUTILS_H
16 #define BORNAGAIN_MVVM_MODEL_MVVM_UTILS_STRINGUTILS_H
18 #include "mvvm/model_export.h"
27 MVVM_MODEL_EXPORT std::string
DoubleToString(
double input,
int precision = 12);
42 MVVM_MODEL_EXPORT std::optional<double>
StringToDouble(
const std::string& str);
50 MVVM_MODEL_EXPORT std::vector<std::string>
SplitString(
const std::string& str,
51 const std::string& delimeter);
60 std::vector<double>& result);
MVVM_MODEL_EXPORT void ParseSpaceSeparatedDoubles(const std::string &str, std::vector< double > &result)
Parses string for double values and stores result in a vector.
MVVM_MODEL_EXPORT std::string ScientificDoubleToString(double input, int precision=6)
Returns string representation of scientific double.
MVVM_MODEL_EXPORT std::string RemoveRepeatedSpaces(std::string str)
Removes repeating spaces for a string.
MVVM_MODEL_EXPORT std::string TrimWhitespace(const std::string &str)
Returns string after trimming whitespace surrounding, including tabs and carriage returns.
MVVM_MODEL_EXPORT std::string DoubleToString(double input, int precision=12)
Returns string representation of double with given precision.
MVVM_MODEL_EXPORT std::vector< std::string > SplitString(const std::string &str, const std::string &delimeter)
Split string on substring using given delimeter. Reproduces Python's str.split() behavior.
MVVM_MODEL_EXPORT std::optional< int > StringToInteger(const std::string &str)
Converts string to integer.
MVVM_MODEL_EXPORT std::optional< double > StringToDouble(const std::string &str)
Converts string to double value using classc locale and returns it in the form of optional.
materialitems.h Collection of materials to populate MaterialModel.