1 #ifndef OCRA_UTIL_STRING_UTILITIES_H 2 #define OCRA_UTIL_STRING_UTILITIES_H 15 std::string newString = originalString;
16 std::transform(newString.begin(), newString.end(), newString.begin(), ::tolower);
22 std::string newString = originalString;
23 std::transform(newString.begin(), newString.end(), newString.begin(), ::toupper);
29 std::stringstream valueStream;
30 std::vector<double> doubleVector;
32 valueStream << valueString;
37 for (
double number; valueStream >> number;) {
38 doubleVector.push_back(number);
41 if (valueStream.fail())
48 while (!valueStream.eof());
50 int nRows = doubleVector.size();
51 Eigen::VectorXd eigenVector(nRows);
52 for (
int i=0; i<nRows; i++)
54 eigenVector[i] = doubleVector[i];
62 std::stringstream valueStream;
63 std::vector<int> doubleVector;
65 valueStream << valueString;
70 for (
int number; valueStream >> number;) {
71 doubleVector.push_back(number);
74 if (valueStream.fail())
81 while (!valueStream.eof());
83 int nRows = doubleVector.size();
84 Eigen::VectorXi eigenVector(nRows);
85 for (
int i=0; i<nRows; i++)
87 eigenVector[i] = doubleVector[i];
97 #endif // OCRA_UTIL_STRING_UTILITIES_H Optimization-based Robot Controller namespace. a library of classes to write and solve optimization p...
Eigen::VectorXd stringToVectorXd(const char *valueString)
Eigen::VectorXi stringToVectorXi(const char *valueString)
std::string convertToLowerCase(const std::string &originalString)
std::string convertToUpperCase(const std::string &originalString)