| 130 | } |
| 131 | |
| 132 | public static String extractToken(String str_img,String token) throws IOException { |
| 133 | String pattern = token ; |
| 134 | str_img = str_img.replace("\\r\\n","").replace("\\",""); |
| 135 | str_img = str_img.replace("\\n",""); |
| 136 | Pattern r = Pattern.compile(pattern); |
| 137 | Matcher m = r.matcher(str_img); |
| 138 | |
| 139 | if (m.find()) { |
| 140 | str_img = m.group(1).replace("\"", "").replace("&", "").replace("Base64:", "").replace("base64:", ""); |
| 141 | } |
| 142 | if( str_img.length() > 300){ |
| 143 | str_img = "提取关键字过长,请确认提取是否正确!"; |
| 144 | } |
| 145 | |
| 146 | // if( str_img.length() > 100){ |
| 147 | // str_img = str_img.substring(0,10) + "……" + str_img.substring(str_img.length()-10 , str_img.length()); |
| 148 | // } |
| 149 | |
| 150 | return str_img; |
| 151 | } |
| 152 | |
| 153 | |
| 154 | public static byte[] dataimgToimg(String str_img,String words) throws IOException { |