BBS水木清华站∶精华区

发信人: thinkin (强强), 信区: Linux        
标  题: Character Functions  
发信站: BBS 水木清华站 (Thu Feb 17 11:01:08 2000) 
 
<?php 
/* Functions: Converted from <ctype.h>. 
 * Author: John Millaway 
 * 
 * Note: These functions expect a character, 
 * such as 'a', or '?', not an integer. 
 * If you want to use integers, first convert 
 * the integer using the chr() function. 
 * 
 * Examples: 
 * 
 * isalpha('a');  // returns 1 
 * isalpha(chr(97)); // same thing 
 * 
 * isdigit(1); // NO! 
 * isdigit('1'); // yes. 
 */ 
function isalnum ($c){ global $ctype__; return ((($ctype__[( ord($c) )]&(01  
| 02 | 04 ))  != 0)?1:0);} 
function isalpha ($c){ global $ctype__; return ((($ctype__[( ord($c) )]&(01  
| 02 ))  != 0)?1:0);} 
function isascii ($c){ global $ctype__; return (((( ord($c) )<=0177)  != 0)? 
1:0);} 
function iscntrl ($c){ global $ctype__; return ((($ctype__[( ord($c) )]& 040 
 )  != 0)?1:0);} 
function isdigit ($c){ global $ctype__; return ((($ctype__[( ord($c) )]& 04  
)  != 0)?1:0);} 
function isgraph ($c){ global $ctype__; return ((($ctype__[( ord($c) )]&(020 
 | 01 | 02 | 04 ))  != 0)?1:0);} 
function islower ($c){ global $ctype__; return ((($ctype__[( ord($c) )]& 02  
)  != 0)?1:0);} 
function isprint ($c){ global $ctype__; return ((($ctype__[( ord($c) )]&(020 
 | 01 | 02 | 04 | 0200 ))  != 0)?1:0);} 
function ispunct ($c){ global $ctype__; return ((($ctype__[( ord($c) )]& 020 
 )  != 0)?1:0);} 
function isspace ($c){ global $ctype__; return ((($ctype__[( ord($c) )]& 010 
 )  != 0)?1:0);} 
function isupper ($c){ global $ctype__; return ((($ctype__[( ord($c) )]& 01  
)  != 0)?1:0);} 
function isxdigit ($c){ global $ctype__; return ((($ctype__[( ord($c) )]&(01 
00 | 04 ))  != 0)?1:0);} 
$ctype__ = array(32,32,32,32,32,32,32,32,32,40,40,40,40,40,32,32,32,32,32,32 
,32,32,32,32,32,32,32,32,32,32,32,32, 
                  -120,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,4,4,4,4, 
4,4,4,4,4,4,16,16,16,16,16,16, 
                  16,65,65,65,65,65,65,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 
,1,16,16,16,16,16, 
                  16,66,66,66,66,66,66,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 
,2,16,16,16,16,32, 
                  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 
0,0,0, 
                  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 
0,0,0, 
                  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 
0,0,0, 
                  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 
0,0,0); 
?> 
---------------------------------------------------------------------------- 
---- 
 
-- 
 
人生到处知何似? 
    应似飞鸿踏雪泥。 
        泥上偶然留指爪, 
            鸿飞那复计东西! 
        
 
※ 来源:·BBS 水木清华站 smth.org·[FROM: 162.105.37.191] 

BBS水木清华站∶精华区