함수 hex2dec()

hex2dec()
hexdec()

1 C++[ | ]

C++
Copy
#include <iostream> 
using namespace std; 
int main() 
{ 
    cout << stoi("0",     nullptr, 16) << endl;  // 0
    cout << stoi("-a",    nullptr, 16) << endl;  // -10
    cout << stoi("2F",    nullptr, 16) << endl;  // 47
    cout << stoi("-fffe", nullptr, 16) << endl;  // -65534
    cout << stoi("FFFF",  nullptr, 16) << endl;  // 65535
}
Loading

2 Java[ | ]

Java
Copy
int a = Integer.parseInt("a", 16); // 10
int b = Integer.parseInt("2f", 16); // 47
int c = Integer.parseInt("ffff", 16); // 65535

3 PHP[ | ]

PHP
Copy
echo hexdec('a');    // 10
echo hexdec('2f');   // 47
echo hexdec('ffff'); // 65535
Loading

4 같이 보기[ | ]