--------------------------------------------------------------------------- Name: gtString::toLongNumber Description: Converts a string that contains an integer number into a long. Arguments: longNumber - Will get the output long. Return Val: bool - Success / failure. Author: AMD Developer Tools Team Date: 29/11/2004 -----------------------------------------------------------
| 1948 | // Date: 29/11/2004 |
| 1949 | // --------------------------------------------------------------------------- |
| 1950 | bool gtString::toLongNumber(long& longNumber) const |
| 1951 | { |
| 1952 | bool retVal = false; |
| 1953 | |
| 1954 | // Verify that this string represents an integer number |
| 1955 | if (isIntegerNumber()) |
| 1956 | { |
| 1957 | // Remove the thousands separators from the string: |
| 1958 | gtString clone = *this; |
| 1959 | clone.removeChar(GT_THOUSANDS_SEPARATOR); |
| 1960 | |
| 1961 | // Convert the string to an int: |
| 1962 | #if AMDT_BUILD_TARGET == AMDT_WINDOWS_OS |
| 1963 | longNumber = _wtol(clone.asCharArray()); |
| 1964 | #else |
| 1965 | wchar_t* endPosition = nullptr; |
| 1966 | longNumber = wcstol(clone.asCharArray(), &endPosition, 10); |
| 1967 | #endif |
| 1968 | retVal = true; |
| 1969 | } |
| 1970 | |
| 1971 | return retVal; |
| 1972 | } |
| 1973 | |
| 1974 | |
| 1975 | // --------------------------------------------------------------------------- |
nothing calls this directly
no test coverage detected