Advertisement

C++中对URL的处理

阅读量:
复制代码
 #include <iostream>

    
 #include <string>
    
 using namespace std;
    
  
    
 char dec2hexChar(short int n) {
    
 	if (0 <= n && n <= 9) {
    
 		return char(short('0') + n);
    
 	}
    
 	else if (10 <= n && n <= 15) {
    
 		return char(short('A') + n - 10);
    
 	}
    
 	else {
    
 		return char(0);
    
 	}
    
 }
    
  
    
 short int hexChar2dec(char c) {
    
 	if ('0' <= c && c <= '9') {
    
 		return short(c - '0');
    
 	}
    
 	else if ('a' <= c && c <= 'f') {
    
 		return (short(c - 'a') + 10);
    
 	}
    
 	else if ('A' <= c && c <= 'F') {
    

全部评论 (0)

还没有任何评论哟~