Contents

조회 수 6114 댓글 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. [ios] NSString, RegularExpression Find/Replace

    Date2017.04.14 CategoryDevelop Byhooni Views6114
    Read More
  2. [ios] 비디오,네트워크,소셜로그인 테스트

    Date2017.04.04 CategoryDevelop Byhooni Views2271
    Read More
  3. 사이버보안실무 수업 메모

    Date2017.03.30 CategoryEtc Byhooni Views2966
    Read More
  4. [mysql] 쿼리 실행시 ERROR 1366 (HY000) : incorrect string value : for column

    Date2017.03.30 CategoryDatabase Byhooni Views16335
    Read More
  5. [ios] Xcode에서 특정 파일만 ARC 따로 설정하는 방법

    Date2017.03.29 CategoryDevelop Byhooni Views4196
    Read More
  6. 사이버보안실무 수업 메모

    Date2017.03.23 CategoryDevelop Byhooni Views0
    Read More
  7. Mac OS 에 Jenkins 설치하기 (Homebrew)

    Date2017.03.15 CategoryDevelop Byhooni Views13247
    Read More
  8. [ios] 동영상 플레이어 샘플 (for PIP Player)

    Date2017.03.15 CategoryDevelop Byhooni Views12911
    Read More
  9. 종합시험 관련 자료

    Date2017.03.15 CategoryEtc Byhooni Views0
    Read More
  10. [js] Javascript로 만든 포트리스 (2010)

    Date2017.03.03 CategoryDevelop Byhooni Views5470
    Read More
  11. [ios] Facebook Cache 갱신하는 함수

    Date2017.02.27 CategoryDevelop Byhooni Views7038
    Read More
  12. 모바일 프로그래머가 갖추어야 할 필수 역량

    Date2017.02.16 CategoryEtc Byhooni Views6479
    Read More
Board Pagination Prev 1 ... 5 6 7 8 9 10 11 12 13 14 ... 99 Next
/ 99