MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / safeStringToFloat

Function safeStringToFloat

Source/Node/AlignNode.cpp:140–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138}
139
140static std::optional<float> safeStringToFloat(std::string_view str) {
141 try {
142 std::string strValue(str);
143 return std::stof(strValue);
144 } catch (const std::invalid_argument&) {
145 return std::nullopt;
146 } catch (const std::out_of_range&) {
147 return std::nullopt;
148 }
149 return std::nullopt;
150}
151
152enum class CSSValue {
153 Number,

Callers 2

cssMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected