MCPcopy Create free account
hub / github.com/HelenOS/helenos / stol

Function stol

uspace/lib/cpp/src/string.cpp:41–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39 }
40
41 long stol(const string& str, size_t* idx, int base)
42 {
43 char* end;
44 long result = ::strtol(str.c_str(), &end, base);
45
46 if (end != str.c_str())
47 {
48 if (idx)
49 *idx = static_cast<size_t>(end - str.c_str());
50 return result;
51 }
52 // TODO: no conversion -> invalid_argument
53 // TODO: ERANGE in errno -> out_of_range
54 return 0;
55 }
56
57 unsigned long stoul(const string& str, size_t* idx, int base)
58 {

Callers

nothing calls this directly

Calls 2

strtolFunction · 0.85
c_strMethod · 0.80

Tested by

no test coverage detected