Contents

조회 수 928 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

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

단축키

Prev이전 문서

Next다음 문서

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

정규표현식으로 문자열 교체하는 예제

예) Kakao 계정에서 닉네임에 이모티콘 있을 시 제거하는 내용

NSString *pattern = @"[^\uAC00-\uD7A3xfe0-9a-zA-Z\\s]";
NSString *kakaoNickname = @"123 &1245; Hooni Test!!^^";

NSError *error = nil;
NSRegularExpression *regex =
    [NSRegularExpression regularExpressionWithPattern:pattern
        options:NSRegularExpressionCaseInsensitive error:&error];

NSString *modifiedString =
    [regex stringByReplacingMatchesInString:kakaoNickname options:0
        range:NSMakeRange(0, [kakaoNickname length]) withTemplate:@""];

NSLog(@"kakaoNickname : %@", modifiedString);



?

  1. Mac OS 에 Jenkins 설치하기 (Homebrew)

  2. [android] Calling activity function from separate class

  3. [android] Canvas를 이용해 이미지 확대/축소 하기

  4. [c#] 웹문서 소스(html) 긁어오기

  5. [c] 64bit 머신에서 inet_ntoa() 사용시 Segment fault 대처 방법법

  6. [c] Mac OS 에 gmp(gmp.h) 라이브러리 설치

  7. [ios] NSString, RegularExpression Find/Replace

  8. [ios] UUID 생성 + Key Chain 연동

  9. [ios] 동영상 플레이어 샘플 (for PIP Player)

  10. [ios] 소소한 팁 (Rect,Point,Path,URL 등)

  11. [java] 스트러츠(Struts) 세팅 ㅋㅋ

  12. [java] 입출력 스트림 1부 (문자)

Board Pagination Prev 1 2 Next
/ 2