Contents

조회 수 28995 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
아래의 strBody에 search를 replace로 교체하는 방법..
NSMutableString *strBody = [NSMutableString stringWithString:_noticeInfo.body];
   
NSString *search = @"
";
NSString *replace = @"
";


1. range를 바꿔가며 패턴을 찾고 교체
NSRange range = [strBody rangeOfString:search];
while(range.location != NSNotFound){
    [strBody replaceCharactersInRange:range withString:replace];
    range = [strBody rangeOfString:search];
}


2. range를 문자열 전체로 잡고 한번에 교체
NSRange range = NSMakeRange(0, [strBody length]);
[strBody replaceOccurrencesOfString:search withString:replace options:NSLiteralSearch range:range];


?

  1. [ios] iOS에서 디바이스 종류 알아오기

  2. [ios] iphone SetDeviceOrientation 화면 강제 회전

  3. [ios] libxml/tree.h file not found

  4. [ios] Locale Identifiers

  5. [ios] NavigationController 에서 왼쪽(back) 버튼 후킹하기

  6. [ios] None IB vs. StoryBoard 샘플 소스

  7. [ios] NSData to NSString (NSString to NSData)

  8. [ios] NSData 클래스에 대해 (NSData <-> char*)

  9. [ios] NSMutableString 문자열 패턴 교환

  10. [ios] NSNotificationCenter 초간단 사용 예~ ㅋㄷ

  11. [ios] NSString URL Encode/Decode (인코딩/디코딩)

  12. [ios] NSString 간단한 정규식 사용법

Board Pagination Prev 1 ... 38 39 40 41 42 43 44 45 46 47 ... 98 Next
/ 98