MCPcopy Create free account
hub / github.com/dds-bridge/dds / str2int

Function str2int

library/tests/parse.cpp:698–722  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

696
697
698bool str2int(
699 const string& text,
700 int& res)
701{
702 int i;
703 size_t Pos;
704 try
705 {
706 i = stoi(text, &Pos);
707 if (Pos != text.size())
708 return false;
709
710 }
711 catch ([[maybe_unused]] const invalid_argument& ia)
712 {
713 return false;
714 }
715 catch ([[maybe_unused]] const out_of_range& ia)
716 {
717 return false;
718 }
719
720 res = i;
721 return true;
722}
723

Callers 3

read_fileFunction · 0.85
get_int_elementFunction · 0.85
strip_quotesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected