MCPcopy Create free account
hub / github.com/bytedance/bolt / parseMonthText

Function parseMonthText

bolt/functions/lib/DateTimeFormatter.cpp:483–500  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

481}
482
483int64_t parseMonthText(const char* cur, const char* end, Date& date) {
484 if ((end - cur) >= 3) {
485 auto it = monthMap.find(std::string_view(cur, 3));
486 if (it != monthMap.end()) {
487 date.month = it->second.second;
488 if (end - cur >= it->second.first.size() + 3) {
489 if (std::strncmp(
490 cur + 3, it->second.first.data(), it->second.first.size()) ==
491 0) {
492 return it->second.first.size() + 3;
493 }
494 }
495 // If the suffix didn't match, still ok. Return a prefix match.
496 return 3;
497 }
498 }
499 return -1;
500}
501
502int64_t parseDayOfWeekText(const char* cur, const char* end, Date& date) {
503 if ((end - cur) >= 3) {

Callers 1

parseFromPatternFunction · 0.85

Calls 4

findMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected