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

Function is_float

extlibs/vili/src/utils.cpp:35–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33 }
34
35 bool is_float(const std::string& str)
36 {
37 std::string float_str = str;
38 bool is_a_float = false;
39 if (!float_str.empty())
40 {
41 if (float_str.substr(0, 1) == "-")
42 float_str = float_str.substr(1);
43 if (count(float_str, ".") == 1)
44 {
45 is_a_float = true;
46 float_str.erase(float_str.find('.'));
47 }
48 return (
49 std::all_of(float_str.begin(), float_str.end(), is_digit) && is_a_float);
50 }
51 return false;
52 }
53
54 std::string truncate_float(const std::string& str)
55 {

Callers 1

value_typeFunction · 0.85

Calls 7

countFunction · 0.85
substrMethod · 0.80
emptyMethod · 0.45
eraseMethod · 0.45
findMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected