2009-07-09 12 views

답변

0

NSString에서 문자를 제거하려고한다고 가정합니다. 나는 빠른 구글 검색을했고 이것을 발견했다 link.

이 정보가 도움이되기를 바랍니다.

+0

아니라, 답을 제공하는 것을 고려 대답이 명확하지 않은 토론 게시판에 연결하는 것보다 – notnoop

1

이 시도 :

NSCharacterSet* badUnicodeCharSet = [NSCharacterSet characterSetWithCharactersInString:@"\u0097"]; 
theString = [[theString componentsSeparatedByCharactersInSet:badUnicodeCharSet] componentsJoinedByString:@""]; 
3

이 \ u0097을 제거하는 것이 가장 간단합니다 : 그 방법 are right here에 대한

NSString * deGremlinedString = [theString stringByReplacingOccurrencesOfString:@"\u0097" withString:@""]; 

워드 프로세서를. 시작 문자열이 다음 you can use this method 인 NSMutableString 인 경우

또는 :

[theMutableString replaceOccurrencesOfString:@"\u0097" withString:@"" options:NSLiteralSearch range:NSMakeRange(0, [theMutableString length])]; 
0

합니다. 그래서 @"\\u0097". 나는 긍정적 아니지만, 나는 말한다 this page을 읽어

그 이유는 첫째 백 슬래시 (그래서 당신은 "\" "@ 등의 작업을 수행 할 수 있습니다) 리터럴 문자열의 탈출이다, 두 번째 백 슬래시는이 잘못된 경우

죄송합니다 --boredzo. NSConstantString에 의해 구문 분석 할 수있는 문자열로를 만드는 일이지만, 내가 페이지에서 이해 것이었다.

관련 문제