File tree 2 files changed +18
-2
lines changed
main/java/rikka/smscodehelper/utils
test/java/rikka/smscodehelper/utils
2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ public int compare(String o1, String o2) {
43
43
44
44
// 分出每个句子 并在有关键词的句子里找验证码
45
45
ArrayList <String > sentence ;
46
- sentence = findCodeSentence (content );
46
+ sentence = findSentence (content );
47
47
48
48
for (String str : sentence ) {
49
49
if (findKeyWord (str ) != -1 ) {
@@ -98,7 +98,7 @@ private static int findKeyWord(String content) {
98
98
return codeFindStart ;
99
99
}
100
100
101
- private static ArrayList <String > findCodeSentence (String content ) {
101
+ private static ArrayList <String > findSentence (String content ) {
102
102
ArrayList <String > list = new ArrayList <>();
103
103
104
104
int last = 0 ;
@@ -124,9 +124,23 @@ private static boolean isCodeChar(char ch) {
124
124
return ((ch >= 'A' && ch <= 'Z' ) || (ch >= '0' && ch <= '9' ));
125
125
}
126
126
127
+ private static String getStringAfter (String content , String string ) {
128
+ int startPos = content .indexOf (string );
129
+ if (startPos == -1 ) {
130
+ return content ;
131
+ } else {
132
+ return content .substring (startPos );
133
+ }
134
+ }
135
+
127
136
private static String findCode (String content ) {
128
137
content += " " ;
129
138
139
+ // 如果有冒号
140
+ content = getStringAfter (content , ":" );
141
+ content = getStringAfter (content , ":" );
142
+
143
+
130
144
int startPos = -1 ;
131
145
for (int i = 0 ; i < content .length (); i ++) {
132
146
char ch = content .charAt (i );
Original file line number Diff line number Diff line change @@ -41,5 +41,7 @@ private void setSmsContact() {
41
41
SmsContactCodeMap .put (SMSContact5 , "060973" );
42
42
String SMSContact6 = "您在付款,为防诈骗千万不要告诉他人验证码505513,商户为汇付天下,金额80元。如有疑问请停止操作。(短信编号:245747)【工商银行】" ;
43
43
SmsContactCodeMap .put (SMSContact6 , "505513" );
44
+ String SMSContact7 = "任何向你索要验证码的都是骗子,千万别给!您正在向www(尾号4832)转账,验证码370000,100元。" ;
45
+ SmsContactCodeMap .put (SMSContact7 , "370000" );
44
46
}
45
47
}
You can’t perform that action at this time.
0 commit comments