MCPcopy Create free account
hub / github.com/NazaraEngine/NazaraEngine / ParseDecimal

Function ParseDecimal

src/Nazara/Network/AlgorithmNetwork.cpp:22–44  ·  view source on GitHub ↗

! * \brief Parses a decimal number * \return true If successful * * \param str C-string symbolizing the string to parse * \param number Optional argument to return the number parsed * \param endOfRead Optional argument to determine where parsing stopped */

Source from the content-addressed store, hash-verified

20 * \param endOfRead Optional argument to determine where parsing stopped
21 */
22 bool ParseDecimal(const char* str, unsigned int* number, const char** endOfRead)
23 {
24 const char* ptr = str;
25 unsigned int val = 0;
26 while (*ptr >= '0' && *ptr <= '9')
27 {
28 val *= 10;
29 val += *ptr - '0';
30
31 ++ptr;
32 }
33
34 if (str == ptr)
35 return false;
36
37 if (number)
38 *number = val;
39
40 if (endOfRead)
41 *endOfRead = ptr;
42
43 return true;
44 }
45
46 /*!
47 * \brief Parses a hexadecimal number

Callers 1

ParseIPAddressFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected