标签:uitextfield uilabel ios 字符数
+ (int)convertToInt:(NSString*)strtemp
{
int strLength = 0;
char *p = (char *)[strtemp cStringUsingEncoding:NSUnicodeStringEncoding];
int length = [strtemp lengthOfBytesUsingEncoding:NSUnicodeStringEncoding];
for (int i = 0; i < length; i ++) {
if (*p) {
p ++;
strLength ++;
}else{
p ++;
}
}
return (strLength+1)/2;
}
UITextField 计算输入的字符个数(包含中英文数字特殊符号)
标签:uitextfield uilabel ios 字符数
原文地址:http://blog.csdn.net/licdev/article/details/44199733