-1
我需要修复代码的帮助。 我需要它来查看子类的前两个字符。如果是字母数字(字母和数字)subclassize=7
;如果前两个字符都是数字 subclassize=4
。 这是代码:字符串中的字母数字
int startrentex=0;
int rentexsize=0;
//int totalsize=0;
int subclasssize=7;
//int descriptionsize=9;
int currentlength=[enteredText length];
if(appdata.appSettings.BarCodeStyle==0) {
if(currentlength>1){
NSString *str = [enteredText substringWithRange:NSMakeRange(1, 1)];
int testint=[str intValue];
if(![str isEqualToString:@"0"] && testint==0)
subclasssize=7;
else
subclasssize=4;
//a3fs12345hi there
//1B3456712345hi there
}
startrentex=subclasssize;
if(currentlength>subclasssize)
{
BOOL isspace=YES;
欢迎来到Stack Overflow。请尽快阅读[关于]页面。这是Objective C的代码,不是吗?大量使用''''强烈表明,无论如何它不是C++。如果你使用了正确的标签([tag:objective-c],如果我的假设是正确的),你会得到更好的答案。 –
无关注 - 请使用键盘上的空格键。 “这是更容易阅读?”或“Isthiseasiertoread?”代码也一样。 'if(currentLength> subclasssize)'比'if(currentLength> subclasssize)'更容易。 – rmaddy
您需要告诉我们当前代码有什么问题,否则问题不完整。 – Cristik