2016-02-02 07:23:26 +00:00
|
|
|
package osc.git.eh3.test;
|
|
|
|
|
|
|
|
import java.text.ParseException;
|
|
|
|
import java.text.ParsePosition;
|
|
|
|
import java.text.SimpleDateFormat;
|
2016-02-20 01:59:10 +00:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Arrays;
|
2016-02-02 07:23:26 +00:00
|
|
|
import java.util.Date;
|
|
|
|
import java.util.HashMap;
|
2016-02-20 01:59:10 +00:00
|
|
|
import java.util.List;
|
2016-02-02 07:23:26 +00:00
|
|
|
import java.util.Map;
|
|
|
|
|
2016-02-20 01:59:10 +00:00
|
|
|
import net.sf.json.JSONArray;
|
|
|
|
import net.sf.json.JSONObject;
|
|
|
|
|
2016-02-02 07:23:26 +00:00
|
|
|
public class TestCode {
|
|
|
|
|
2016-02-20 01:59:10 +00:00
|
|
|
public static void main(String[] args) throws Exception {
|
2016-02-02 07:23:26 +00:00
|
|
|
// TODO Auto-generated method stub
|
2016-02-20 01:59:10 +00:00
|
|
|
// String pathName = "/dsp/archer/dddfd/jkjl";
|
|
|
|
//
|
|
|
|
// String projectName = pathName.substring(0,
|
|
|
|
// pathName.indexOf("archer"));
|
|
|
|
//
|
|
|
|
// System.out.println(projectName);
|
|
|
|
|
|
|
|
// SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
// ParsePosition pos = new ParsePosition(0);
|
|
|
|
// System.out.println(formatter.parse("dsd", pos));
|
|
|
|
|
|
|
|
// System.out.println(parseDate("") - 2232);
|
|
|
|
|
|
|
|
// Map<String, Object> resultMap = new HashMap<String, Object>();
|
|
|
|
// System.out.println((String)resultMap.get("dd"));
|
|
|
|
|
|
|
|
// try {
|
|
|
|
// String str = null;
|
|
|
|
// str.equals("");
|
|
|
|
// } catch (Exception e) {
|
|
|
|
// System.out.println(e.getMessage());
|
|
|
|
// e.printStackTrace();
|
|
|
|
// }
|
|
|
|
// System.out.println("fffff");
|
|
|
|
|
|
|
|
// String[] s = {"111","eee"};
|
|
|
|
// System.out.println(Arrays.toString(s));
|
|
|
|
|
|
|
|
// List<String> list = new ArrayList<String>();
|
|
|
|
// list.add("2");
|
|
|
|
// list.add("3");
|
|
|
|
// list.add("7");
|
|
|
|
// list.add("1");
|
|
|
|
//
|
|
|
|
// System.out.println(list.toString());
|
|
|
|
|
|
|
|
// JSONArray areaTarget = new JSONArray();
|
|
|
|
// areaTarget.add("3");
|
|
|
|
// areaTarget.add("5");
|
|
|
|
// areaTarget.add("4");
|
|
|
|
// areaTarget.add("7");
|
|
|
|
// System.out.println(JSONArray.toList(areaTarget));
|
2016-02-02 07:23:26 +00:00
|
|
|
|
|
|
|
|
2016-02-20 01:59:10 +00:00
|
|
|
// String whiteStr = "2,4,5,8,3";
|
|
|
|
// System.out.println(JSONArray.fromObject(whiteStr.split(",")));
|
2016-02-02 07:23:26 +00:00
|
|
|
|
2016-02-20 01:59:10 +00:00
|
|
|
// for (int i = 0;i<2;i++) {
|
|
|
|
//
|
|
|
|
// if ("1".equals("1")) {
|
|
|
|
// if ("1".equals("1")) {
|
|
|
|
// System.out.println("111111111111111");
|
|
|
|
// continue;
|
|
|
|
// }
|
|
|
|
// System.out.println("2222222222222222");
|
|
|
|
// }
|
|
|
|
// System.out.println("3333333333333333333333");
|
|
|
|
// }
|
2016-02-02 07:23:26 +00:00
|
|
|
|
2016-02-20 01:59:10 +00:00
|
|
|
// String str = "http://www.test.com";
|
|
|
|
// System.out.println(str.replace("http://www.", "").replace("www.", ""));
|
2016-02-02 07:23:26 +00:00
|
|
|
|
2016-02-20 01:59:10 +00:00
|
|
|
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("HH");
|
|
|
|
String str = "23:59:59";
|
|
|
|
System.out.println(sdf.format(formatter.parse(str)));
|
2016-02-02 07:23:26 +00:00
|
|
|
|
2016-02-20 01:59:10 +00:00
|
|
|
|
2016-02-02 07:23:26 +00:00
|
|
|
}
|
2016-02-20 01:59:10 +00:00
|
|
|
|
2016-02-02 07:23:26 +00:00
|
|
|
public static Long parseDate(String s) {
|
2016-02-20 01:59:10 +00:00
|
|
|
Long time = null;
|
|
|
|
if (s == null || "" == s) {
|
2016-02-02 07:23:26 +00:00
|
|
|
time = null;
|
2016-02-20 01:59:10 +00:00
|
|
|
} else {
|
2016-02-02 07:23:26 +00:00
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
try {
|
|
|
|
Date date = format.parse(s);
|
2016-02-20 01:59:10 +00:00
|
|
|
time = date.getTime();
|
2016-02-02 07:23:26 +00:00
|
|
|
} catch (ParseException e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return time;
|
2016-02-20 01:59:10 +00:00
|
|
|
}
|
2016-02-02 07:23:26 +00:00
|
|
|
}
|