-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path3863F218-F322-4855-A0B6-3B3DCAE137F7.codesnippet
40 lines (39 loc) · 1.46 KB
/
3863F218-F322-4855-A0B6-3B3DCAE137F7.codesnippet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDECodeSnippetCompletionPrefix</key>
<string>my_regex2bool_oc_func</string>
<key>IDECodeSnippetCompletionScopes</key>
<array>
<string>All</string>
</array>
<key>IDECodeSnippetContents</key>
<string>- (BOOL)textRegex:(NSString *)targetStr {
//1. 数字:^[0-9]*$
//2. m-n位的数字:^\d{m,n}$
//3. 汉字:^[\u4e00-\u9fa5]{0,}$
//4. 英文和数字:^[A-Za-z0-9]{4,40}$
//5. 手机号码:^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$
//6. 身份证号(15位、18位数字):^\d{15}|\d{18}$
//7. 整数或者小数:"^([1-9][0-9]*.?|0.)[0-9]*$"
//8. 12位数字字母:"^[1-5a-z]{12}$"
NSString *check = @"^[0-9]*$";
NSPredicate *predice =[NSPredicate predicateWithFormat:@"self matches %@",check];
BOOL result = [predice evaluateWithObject:targetStr];
return result;
}</string>
<key>IDECodeSnippetIdentifier</key>
<string>3863F218-F322-4855-A0B6-3B3DCAE137F7</string>
<key>IDECodeSnippetLanguage</key>
<string>Xcode.SourceCodeLanguage.Generic</string>
<key>IDECodeSnippetSummary</key>
<string>正则判断,oc版</string>
<key>IDECodeSnippetTitle</key>
<string>my_regex2bool_oc_func</string>
<key>IDECodeSnippetUserSnippet</key>
<true/>
<key>IDECodeSnippetVersion</key>
<integer>2</integer>
</dict>
</plist>