freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

[院校資料]javalession9常用類-資料下載頁

2025-02-21 03:05本頁面
  

【正文】 [ad]:a至 d任意 限定符模式 X?:0次或 1次 X*:0次或多次 X+:1次或多次 X{n}:恰好 n次 X{n,m}:n至 m次 “ \\dth”匹配“ 4th” “9th”… 模式匹配 建立模式對(duì)象 : (String patter) Pattern p= (“a\\d)。 包 建立匹配對(duì)象 : (CharSequence mstr) String mstr=“a1a2a3”。 Matcher m=(mstr)。 待匹配字符序列 Matcher類常用方法 ?boolean find() 尋找匹配的下一子序列 ?boolean find(int start) 若 find()返回 true, start()和 end()可以得到該匹配模式子序列在 mstr中的開始位置和結(jié)束位置。 group()返回一個(gè)匹配模式的字符串對(duì)象 。 06:like12 611:hate3 1420:like56 2025:hate4 import .*。 public class Zstr { public static void main(String[] args) { String patter=like\\w{2}|hate\\w{1}。 String mstr=like12hate3no9like56hate4。 Pattern p=(patter)。 Matcher m=(mstr)。 while(()) { String str=()。 (()++()+:)。 (str)。 } } } 演示:示例 5 Matcher類示例 練習(xí) ?已知正則表達(dá)式: 0[xX][09afAF]和查找源: “12 0x 0x12 0Xf 0xg”,執(zhí)行 start方法后的結(jié)果是什么? ? 常用類 ? 字符串常用方法 ? Object類常用方法 ? 日期、數(shù)字和貨幣格式 ? 正則表達(dá)式, Pattern和 Matcher類進(jìn)行模式匹配 ? 分解字符串 Scanner類 import .*。 class ScanIn { public static void main(String[] args) { (input: )。 try { Scanner s = new Scanner()。 String token。 do { token = (args[0])。 (found + token)。 } while (token != null)。 } catch (Exception e) { (scan exc)。 } } } 演示:示例 6 Scanner類 ?輸出結(jié)果: 練習(xí) ?已知正則表達(dá)式: 0[xX][09afAF]和查找源: “12 0x 0x12 0Xf 0xg”,使用 Scanner類中的方法查找。 StringTokenizer類 分解字符串成可被獨(dú)立使用的單詞 [ ] 創(chuàng)建 StringTokenizer對(duì)象 ?StringTokenizer(String s) ?StringTokenizer(String s,String delim) StringTokenizer類常用方法 ?countTokens() 單詞計(jì)數(shù)變量 ?hasMoreTokens() countTokens0 true ?nextToken() 逐個(gè)獲取單詞 定界符 import .*。 public class ST { public static void main(String[] args) { String str=中國(guó) .四川 .攀枝花 。 StringTokenizer st=new StringTokenizer(str,.)。 int number=()。 (words:+number)。 while(()) { (()+:)。 (())。 } } } words:3 0:中國(guó) 1:四川 2:攀枝花 StringTokenizer類 練習(xí) ? String str =―abc def asdf asdf‖。 如何把上面的字符串分解成一個(gè)個(gè) 單詞 ? 使用 split方法分解字符串 import .*。 class SplitTest { public static void main(String[] args) { String[] tokens = args[0].split(args[1])。 (count + )。 for(int i=0。 i 。 i++) ( + tokens[i] + )。 } } 演示:示例 7 輸出結(jié)果 練習(xí) ? 使用 split方法將 String str =―abc def asdf asdf‖。 字符串分解成一個(gè)個(gè) 單詞 ? 宿題 ?給定月份,年份返回 Vector,寫出一個(gè)方法得出某年某月中哪幾天是星期一 ? ?//使用集合示例 Vector v= new Vector()。 (Object)。 Iterator iterator = ()。 while(()){ ()。
點(diǎn)擊復(fù)制文檔內(nèi)容
教學(xué)課件相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1