Develop
2017.04.14 10:38
[ios] NSString, RegularExpression Find/Replace
조회 수 854 댓글 0
정규표현식으로 문자열 교체하는 예제
예) 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);
TAG •
-
[ios] URL 랜딩 속도(OpenURL 10초 정지되는) 이슈
-
[android] AlertDialog 메시지 창 띄우기
-
개인적으로 쓰고 있는 bash_profile
-
[ios] NSString, RegularExpression Find/Replace
-
[c] 이진 탐색 두 가지 코드 (재귀/반복)
-
[kotlin] 코틀린 안드로이드 앱 버전/빌드 정보
-
개인적으로 쓰고 있는 zshrc 파일
-
[ios] GMT Date와 Local Date 변환하기
-
[mysql] MySQL 백업 및 복구
-
사이버보안실무 수업 메모
-
[ios] 비동기 블럭 코드 예제
-
[android] 초간단 얼럿 (AlertDialog)