Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions source/framework/core/src/TRestSystemOfUnits.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 "";
Expand Down Expand Up @@ -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;
}
}

Expand Down
12 changes: 7 additions & 5 deletions source/framework/tools/src/TRestStringHelper.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down