凑个热闹,贴个片断
参数 c 为子串长度
程序代码:
[ 本帖最后由 pycansi 于 2014-11-4 00:18 编辑 ]
参数 c 为子串长度

int func (char* str, int c) { int len; int count; int i; len = strlen (str); if (len % c != 0) { return -1; } count = len / c - 1; for (i=1; i<=count; i++) { if (0 != strncmp (str, str+i*c, c)) { return -1; } } return 0; }
[ 本帖最后由 pycansi 于 2014-11-4 00:18 编辑 ]

莫问前尘有愧,但求今生无悔