2011-08-24 2 views
1

나는 "qytwyqteqe는"나는 단지 qytwyqteqe 아니라 기호 "" 문제 동안

내가 다음 코드 있지만 기부를 사용하여이 문자열을 트리밍을 시도하려는 같은 문자열이

실제로 내가이

arrConvertedDirNames:(
    "(\n \"(\\n \\\"Sudha-feb16-2011-02.30PM\\\"\\n)\"", 
    "\n \"Tharanga-jan16-2011-10.30AM\"\n)\n" 
) 
같은 배열을 가지고 : 오류 중 하나는

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

its giving error for this one @""" 
error: missing terminating "" 

편집 사전에, pls는 고맙습니다 나를 도울 수

내가 순서

NSMutableString *strTrimmedDownloadedDirNames = [NSMutableString stringWithFormat:@"%@",[arrDownloadedDirNames objectAtIndex:0]]; 

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

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

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

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

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

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

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

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


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


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

    [strTrimmedDownloadedDirNames replaceOccurrencesOfString:@"\"" withString:@" " options:NSLiteralSearch range:NSMakeRange(0, [strTrimmedDownloadedDirNames length])]; 
now am getting this array 
arrConvertedDirNames:(
    "Sudha-feb16-2011-02.30PM", 
    "Tharanga-jan16-2011-10.30AM" 
) 

을 탈출 제거하기 위해 교체 다음과 같은 짓을하지만,이 배열은 같아야이

arrConvertedDirNames:(
    Sudha-feb16-2011-02.30PM , 
    Tharanga-jan16-2011-10.30AM 
) 
그래서 배열을 만들기 위해 무엇을 할 수 있는지

,, 하나가 나에게

도움을 주시기 바랍니다

이 :,244,645,333

+0

"\" "은 (는)"이스케이프 문자입니다. –

답변

4

당신은 의미하는 "을 탈출해야합니다 (210)

은 다음과 같아야합니다 replaceOccurrencesOfString:@"\""

+0

나는 이것을 시도했으나 "charecter"를 삭제하지 않았다. – Ravi

1
NSCharacterSet *charterSet = [NSCharacterSet characterSetWithCharactersInString:@"""]; 
stringWithoutCurrentSymbol = [stringWithAnySimbols stringByTrimmingCharactersInSet:charterSet]; 

신중 지정된 문자 세트에 포함 된 수신 문자을 끝에서 모두 제거 에 의해 만들어진 새로운 문자열을 반환합니다.

관련 문제