MCPcopy Create free account
hub / github.com/cocos/cocos-engine / parseCssInt

Function parseCssInt

native/cocos/base/csscolorparser.cpp:236–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

234}
235
236uint8_t parseCssInt(const ccstd::string &str) { // int or percentage.
237 if (str.length() && str.back() == '%') {
238 return clampCssByte(parseFloat(str) / 100.0f * 255.0f);
239 }
240 return clampCssByte(parseInt(str));
241}
242
243float parseCssFloat(const ccstd::string &str) { // float or percentage.
244 if (str.length() && str.back() == '%') {

Callers 1

parseFunction · 0.85

Calls 4

clampCssByteFunction · 0.85
parseFloatFunction · 0.85
parseIntFunction · 0.85
lengthMethod · 0.45

Tested by

no test coverage detected