Java常用工具

2021-07-14 17:52:51 字數 1353 閱讀 5457

自動生成18位id:

verifycode.setid(uniquenumberutils.get18uniquenumber());

dateutils.gettimestamp();

string轉為date型別:

******dateformat sdf = new ******dateformat("yyyy-mm-dd");

date start = new date();

try catch (parseexception e)  

token中獲取loginname:

commontoken tokeninfo = commomtokenservice.selectbytoken(token);

string loginname = tokeninfo.getaccount();

判斷是否為空:

string.isempty();

stringutils.isempty(loginname);

arrayutils.isnotempty(strs);

collectionutils.isnotempty(houses);

// 判斷讀取的資料是否為空

iteratoriterator = shopinfos.iterator(); 

while(iterator.hasnext()) else

}  分頁:

// 指定預設為首頁

if (pno == null || pno < ownerconstants.page_no)

// 此處新增pagehelper將會走***,進行分頁,分頁方法只針對緊跟著pagehelper的查詢方法有效

pagehelper.startpage(pno, ownerconstants.page_size);

// 分頁

pageinfocarbilllistp = new pageinfo(carbilllist);

集合的遍歷器:

iteratoriterator = houses.iterator(); 

while(iterator.hasnext())  

將,分割的string分成string陣列:

string houseidarray = housesid.split(",");

calendar cal = calendar.getinstance();

cal.settime(startdate);

cal.add(calendar.month, month);

date enddate = cal.gettime();

carbilldetail.setenddate(enddate);

Java常用工具類練習

public class testcheckusername 長度大於6,if username.length 6 不能有數字 for int i 0 i 0 system.out.println 使用者名稱符合要求 public class teststringconvert catch pars...

java常用工具類作業

public class demotest 輸出結果 請輸入乙個日期 4月9日2019年 2019年4月9日2.給出乙個隨機字串,判斷有多少字母?多少數字?思路 先把string字串轉換成字元陣列,在用迴圈出來的字元跟ascii比較,大寫字母的ascii值在65 90之間,小寫字母在97 122之間...

SEO常用工具

seo常用工具 搜尋引擎抓取內容模擬器 可以模擬蜘蛛抓取指定網頁,包括text link keywords及description資訊等。頁面相似度檢測工具 檢驗兩個頁面的相似度 如果相似度達80 以上,將可能受到懲罰 sitemap 製作工具 中文 http www.xinqj.com sitem...