Skip to content

Commit

Permalink
Merge pull request openframeworks#1809 from thiagohersan/feature-ofTo…
Browse files Browse the repository at this point in the history
…Double

add ofToDouble to ofUtils. close openframeworks#1489.
  • Loading branch information
arturoc committed Jan 12, 2013
2 parents 8397d24 + 2f0010f commit 7947250
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions libs/openFrameworks/utils/ofUtils.cpp
Expand Up @@ -397,6 +397,14 @@ float ofToFloat(const string& floatString) {
return x;
}

//----------------------------------------
double ofToDouble(const string& doubleString) {
double x = 0;
istringstream cur(doubleString);
cur >> x;
return x;
}

//----------------------------------------
bool ofToBool(const string& boolString) {
static const string trueString = "true";
Expand Down
1 change: 1 addition & 0 deletions libs/openFrameworks/utils/ofUtils.h
Expand Up @@ -149,6 +149,7 @@ string ofHexToString(const string& stringHexString);
int ofToInt(const string& intString);
char ofToChar(const string& charString);
float ofToFloat(const string& floatString);
double ofToDouble(const string& doubleString);
bool ofToBool(const string& boolString);

template <class T>
Expand Down

0 comments on commit 7947250

Please sign in to comment.