这是上下文
if (self.display.text hasPrefix:[NSString stringWithFormat:@"%@ = ", ANYLETTER])
谢谢马特,我对其进行了一些更改,因此它仍然检查了我拥有的其余格式,现在它可以按预期工作。:)
if ([self.display.text rangeOfString:@" = "].location == 1 && [[NSCharacterSet letterCharacterSet] characterIsMember:[self.display.text characterAtIndex:0]])
编辑:这只是检查第一个字符是否是字母
char character = [self.display.text characterAtIndex:0];
if ([[NSCharacterSet lowercaseLetterCharacterSet] characterIsMember:character] || [[NSCharacterSet uppercaseLetterCharacterSet] characterIsMember:character])
{
//String Starts With a Letter
}