조회 수 6123 추천 수 0 댓글 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] Xcode의 디버그 모드에서 콜스택

  2. [ios] 로컬에 있는 JS 파일 웹뷰에서 동적으로 실행하기

  3. [js] AngularJS 란?

  4. [ios] 로컬에 있는 html 실행하기

  5. [ios] 아이폰 앱 이름 및 버전 정보

  6. [svn] Can't convert string from native encoding to 'UTF-8' 메시지가 나오는 경우

  7. [c#] BHO 한샘툴바랑 동현툴바..

  8. [ios] StoryBoard(xib) 없이 프로젝트 만들기

  9. WM미통기 - 10. 조건부확률

  10. [git] 쉬운 버전관리 Git 설명

  11. [ios] VIN Scanner (VIN barcode) 스캐너

  12. [ios] 비디오,네트워크,소셜로그인 테스트

  13. 수리통계학 : 표본공간과 사상-1

  14. [ios] UIWebView를 이용한 로컬 HTML 파일 표시

  15. [linux] yum 업데이트 시 커널 제외하기

  16. [ios] UIView 계층구조

Board Pagination Prev 1 3 4 5 6 7 ... 74 Next
/ 74