MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / trimAsciiWhiteSpace

Function trimAsciiWhiteSpace

Libraries/HttpClient/HttpClient.cpp:82–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80static bool isAsciiWhiteSpace(char c) { return c == ' ' or c == '\t' or c == '\r' or c == '\n'; }
81
82static SC::StringSpan trimAsciiWhiteSpace(SC::Span<const char> span)
83{
84 size_t start = 0;
85 size_t end = span.sizeInBytes();
86 while (start < end and isAsciiWhiteSpace(span[start]))
87 {
88 start += 1;
89 }
90 while (end > start and isAsciiWhiteSpace(span[end - 1]))
91 {
92 end -= 1;
93 }
94 return {{span.data() + start, end - start}, false, SC::StringEncoding::Ascii};
95}
96
97static bool parseAsciiUint64(SC::StringSpan text, SC::uint64_t& value)
98{

Callers 3

getNextHeaderMethod · 0.70
getNextContentCodingMethod · 0.70
getNextTransferCodingMethod · 0.70

Calls 3

isAsciiWhiteSpaceFunction · 0.85
sizeInBytesMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected