大小写互换
String temp= "TYPECODE,TYPENAME,OPERATIONCODE,OPERATIONNAME"; System.out.println(temp.toUpperCase());// 大写转小写 System.out.println(temp.toLowerCase());// 大写转小写
获取uuid
String id = UUID.randomUUID().toString();
判断字符串非空
string str=“111”; if(str!=null&&str.length()!=0){ System.out.println("非空"); }
获得当前时间并转换为 确定格式的string
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式 String operationtime=df.format(new Date());
string格式日期增减
string endTime=“1991-10-11”
//将得到的日期往后推一天 Calendar calendar = new GregorianCalendar(); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); Date date = df.parse(endTime); calendar.setTime(date); calendar.add(calendar.DATE, 1);// 把日期往后增加一天.整数往后推,负数往前移动 // calendar.add(calendar.YEAR, 1);//把日期往后增加一年.整数往后推,负数往前移动 // calendar.add(calendar.DAY_OF_MONTH, 1);//把日期往后增加一个月.整数往后推,负数往前移动 //calendar.add(calendar.DATE, 1);// 把日期往后增加一天.整数往后推,负数往前移动 // calendar.add(calendar.WEEK_OF_MONTH, 1);//把日期往后增加一个月.整数往后推,负数往前移动 String endData=df.format(calendar.getTime());
得到一个500+节点的json文件(被转换为string格式了)
JSONObject jObject1=new JSONObject(); for(int num=0;num<410;num++){ jObject1.put(num+"", num+"ss"); } jObject1.size(); String str=jObject1.toString();
原文:https://www.cnblogs.com/Isolate/p/10832451.html