현재이 같은 문자열 부분을보고 있습니다.아포스트로피 Unichar 비교 문제
if (thisChar == 'a')
[self a];
else if (thisChar == 'b')
[self b];
else if (thisChar == 'c')
[self c];
.........
else if (thisChar == '0')
[self zero];
else if (thisChar == '1')
[self one];
else if (thisChar == '2')
[self two];
else if (thisChar == '3')
[self three];
......... 나는
에 올 때 이 else if (thisChar == '.')
[self period];
else if (thisChar == ',')
[self comma];
else if (thisChar == '?')
[self qmark];
문제는 비록 발생
else if (thisChar == ''')
[self three];
내가 원하는 것은 '(아포스트로피) 기호이지만 원하는대로 할 수 없습니다. 왜 그런지 알지만, 나는 그 길을 모릅니다. 이게 도움이 되겠습니까?
NSString *apostropheString = [[NSString alloc] initWithFormat:@"'"];
unichar apostrophe = [apostropheString characterAtIndex:0];
isEqualToString을 사용할 수 있습니까?
if ([apostrophe isEqualToString: thisChar])
모든 도움을 주시면 감사하겠습니다.
나는 다음과 같은 방법으로 주위를 발견했다.
1). 단일 문자가 아포스트로피 인 NNString을 작성하십시오.
NSString *apostropheString = [[NSString alloc] initWithFormat:@"'"];
2). 제로 인덱스이며, 인덱스가 0
unichar app = [apostropheString characterAtIndex:0];
3) 만 하나 개의 문자가있는 한, 그것은 "응용 프로그램"이라는 unichar로 변환 할 가져옵니다. "thisChar는"동일한 경우 나는 그 말을 "응용 프로그램"실행 "qmark"
else if (thisChar == app)
[self qmark];
에 나는이 같은 문제를 가진 사람을 위해 도움이되기를 바랍니다!
걱정하지 마십시오.이 문제를 해결할 방법을 찾았습니다. 정보 수정보기. –
' '\' ''을 사용할 수 없습니까? – Gabe