人生如逆旅,我亦是行人!江湖人称wsjjeremy.blog.chinaunix.net
ubuntuer
全部博文(930)
intern(3)
string(19)
正则表达式(5)
2011年(60)
2010年(220)
2009年(371)
2008年(279)
baocheng
nba76ers
renjian2
qq576709
mcn304
zibuyule
西农魔峰
曾德标
zhuqing_
shanck
tendy
moshangx
wb123456
smile124
hjshajsh
chenhong
bzhao
python16
分类:
2009-06-24 20:27:36
if od -c urfile | grep '[1-9][0-9][0-9]';then echo "chinese"
fi
file urfile
UTF-8 --- chinese
[root@localhost test]# cat chinese.c#include #include #include intfirst (unsigned char ch){ if (ch >= 0xb0 && ch <= 0xf7) return 1; else return 0;}intsecond (unsigned char ch){ if (ch >= 0xa1 && ch <= 0xfe) return 1; else return 0;}intcheck (const char *p){ int i = 0; for (i = 0; i < strlen (p)-1; i++) if (first (p[i]) && second (p[i + 1])) return 1; return 0;}int main (){ const char *str = "aasdasdas"; check (str) ? printf("there has character!\n"):printf("there has none character!\n"); return 0;}
上一篇:c 二叉树
下一篇:c 桶排序
登录 注册