MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / isStringFloat

Function isStringFloat

src/Core/Utils/StringUtils.cpp:64–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62 }
63
64 bool isStringFloat(const std::string& str)
65 {
66 std::string modifyStr = str;
67 bool isFloat = false;
68 if (!modifyStr.empty())
69 {
70 if (modifyStr.substr(0, 1) == "-")
71 modifyStr = modifyStr.substr(1);
72 if (occurencesInString(modifyStr, ".") == 1)
73 {
74 isFloat = true;
75 replaceInPlace(modifyStr, ".", "");
76 }
77 return (all_of(modifyStr.begin(), modifyStr.end(), isdigit) && isFloat);
78 }
79 return false;
80 }
81
82 bool isStringNumeric(const std::string& str)
83 {

Callers 1

isStringNumericFunction · 0.85

Calls 6

occurencesInStringFunction · 0.85
substrMethod · 0.80
replaceInPlaceFunction · 0.70
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected