diff --git a/source/framework/core/src/TRestSystemOfUnits.cxx b/source/framework/core/src/TRestSystemOfUnits.cxx index a0fbc3e6a..58c69a203 100644 --- a/source/framework/core/src/TRestSystemOfUnits.cxx +++ b/source/framework/core/src/TRestSystemOfUnits.cxx @@ -85,7 +85,7 @@ string GetStandardUnitDefinition(string unitsdef) { return units(unitsdef).ToSta /// \brief Find and return the units definition in a string /// /// We suppose the last of **value** before **units** must be "1234567890(),.-". -/// Hence this prepority can be used to spilt the input string into value part and unit part +/// Hence this prepority can be used to split the input string into value part and unit part /// e.g. /// value="(1,-13)mm" /// value="-3mm" @@ -113,7 +113,7 @@ string FindRESTUnitsInString(string s) { /// can both be recognized /// string RemoveUnitsFromString(string s) { - string valstr1 = s.substr(0, s.find_first_not_of("1234567890(),.-eE/: ")); + string valstr1 = s.substr(0, s.find_first_not_of("1234567890(),.-eE/*+: ")); if (valstr1.size() == 0) { return ""; @@ -280,7 +280,7 @@ TRestSystemOfUnits::TRestSystemOfUnits(string unitsStr) { orderprefix = -1; } else if (unitsStr[pos1 - 1] == '-' || unitsStr[pos1 - 1] == '*') { } else { - RESTWarning << "illegeal unit combiner \"" << unitsStr[pos1 - 1] << "\"" << RESTendl; + RESTWarning << "illegal unit combiner \"" << unitsStr[pos1 - 1] << "\"" << RESTendl; } } diff --git a/source/framework/tools/src/TRestStringHelper.cxx b/source/framework/tools/src/TRestStringHelper.cxx index 0d96327b6..59edf2af1 100644 --- a/source/framework/tools/src/TRestStringHelper.cxx +++ b/source/framework/tools/src/TRestStringHelper.cxx @@ -97,7 +97,7 @@ string REST_StringHelper::CropWithPrecision(string in, Int_t precision) { /// The buffer string may define sub-expressions that will be evaluated by using single quotes. /// /// I.e. The sentence "The following operation 3 x 4 is '3*4'" will be translated to -/// "The following operatin 3 x 4 is 12". +/// "The following operation 3 x 4 is 12". /// string REST_StringHelper::ReplaceMathematicalExpressions(string buffer, Int_t precision, string errorMessage) { @@ -585,8 +585,9 @@ TRestStringOutput::REST_Verbose_Level REST_StringHelper::StringToVerboseLevel(st /// \brief Gets a double from a string. /// Double_t REST_StringHelper::StringToDouble(string in) { - if (isANumber(in)) { - return stod(in); + std::string out = ReplaceMathematicalExpressions(in, 0); + if (isANumber(out)) { + return stod(out); } else { return -1; } @@ -596,8 +597,9 @@ Double_t REST_StringHelper::StringToDouble(string in) { /// \brief Gets a float from a string. /// Float_t REST_StringHelper::StringToFloat(string in) { - if (isANumber(in)) { - return stof(in); + std::string out = ReplaceMathematicalExpressions(in, 0); + if (isANumber(out)) { + return stof(out); } else { return -1; }