package com.bailian.util;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class TextParser {
private static final String D8 = "\\d{8}\\D";
private static String ASC;
private static String DES;
static {
StringBuilder ascBuilder = new StringBuilder();
for(int i = 48; i < 58; i++) {
ascBuilder.append(Character.toChars(i));
}
ASC = ascBuilder.toString();
StringBuilder desBuilder = new StringBuilder();
for(int i = 57; i > 47; i--) {
desBuilder.append(Character.toChars(i));
}
DES = desBuilder.toString();
System.out.println(DES);
}
public static String parse(String text) {
Pattern pattern = Pattern.compile(D8);
Matcher matcher = pattern.matcher(text);
if(matcher.find()) {
String result = matcher.group();
String target = result.substring(0, 8);
if(ASC.contains(target)) {
return target;
}
}
return "";
}
public static void main(String[] args) throws IOException {
System.out.println("请输入需要检测的文本...");
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String text = reader.readLine();
System.out.println(TextParser.parse(text));
}
}
tools...............
good blog [url]http://www.ophonesdn.com/article/list;jsessionid=FAD3DAF380F339A58E5F92E1B43DC4E1?sort=&tag=136[/url]
apk发编译 [url]http://www.maxhis.info/androiding/android-apk-decompile/[/url]
http://apps.hi.baidu.com/share/detail/39007722
http://video.sina.com.cn/v/b/75355209-1935237481.html
http://blog.csdn.net/kongxx/article/details/7525476
http://wenku.baidu.com/view/a7180912a216147917112823.html
http://www.ibm.com/developerworks/cn/java/j-lo-jsouphtml/
http://www.eoeandroid.com/topic-tag.html?from=forum
http://www.shuangy.com/waigua.html 全图
http://www.oschina.net/code/snippet_16_2735
http://redstarofsleep.iteye.com/blog/1307608
http://blog.csdn.net/xc138/article/details/5904779
http://csvjdbc.sourceforge.net/
http://static.springsource.org/spring-webflow/docs/2.3.x/reference/html/ch04s04.html
http://blog.csdn.net/feng88724/article/details/6859502
http://cxf.apache.org/docs/jax-rs-and-jax-ws.html
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>apache-cxf</artifactId>
<version>2.7.4</version>
</dependency>
public static void main(String[] args) throws ParseException {
String time = "2013/09/17 13:40";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm");
Date date = sdf.parse(time);
System.out.println(date.getTime());
System.out.println("-------------分界线---------------");
long currentTimeStamp = System.currentTimeMillis();
Date now = new Date(currentTimeStamp);
System.out.println(sdf.format(now));
}
http://www.2cto.com/kf/201109/106221.html