Title:Linux C判断字符串是否为数字 --2013-10-14 15:54
#include <ctype.h> #include <string.h> int IsInt(char* str) { int len; len = strlen(str); int i=0; for(i;i<len;i++) { if(!(isdigit(str[i]))) return 0; } return 1; }
时间: 2024-08-05 23:15:42
Title:Linux C判断字符串是否为数字 --2013-10-14 15:54
#include <ctype.h> #include <string.h> int IsInt(char* str) { int len; len = strlen(str); int i=0; for(i;i<len;i++) { if(!(isdigit(str[i]))) return 0; } return 1; }