java常用语句

//str=[a,b,c] 判断是否包含元素

Arrays.asList(str).contains("a")

------------------------------------------------------------------------

//str2=a|b|c 字符串分隔

str2.split("\\|")[0]

-------------------------------------------------------------------------

//jsonArray 数组

 JSONArray jarray= JSONArray.fromObject(json.getString("key")); // 首先把字符串转成 JSONArray  对象     

 for(int i=0;i<jarray.size();i++){        
          String key = jarray.getString(i);

   }  

//json 转对象

JSONObject json=JSONObject.fromObject(back);
 AntNotice notice = (AntNotice) JSONObject.toBean(json,AntNotice.class);

猜你喜欢

转载自beiqi.iteye.com/blog/2229279