声母 韵母 a o e ai ei ao ou er an en ang eng i ia ie iao iu ian in iang ing
音节 a o e ai ei ao ou er an en ang eng yi ye yin ying
b ba bo bai bei baoban ben bang beng bi bie biao bian bin bing
p pa po pai pei pao pou pan pen pang peng pi pie piao pian pin ping
m ma mo me mai mei mao mou man men mang meng mi mie miao miu mian min ming
f fa fofei fou fan fen fang feng
d da de dai dei dao dou dan dang deng di die diao diu dianding
t ta te tai tao tou tan tang teng ti tie tiao tianting
n na ne nai nei nao nou nan nen nang neng ni nie niao niu nian nin niang ning
l la le lai lei lao lou lan lang leng li lia lie liao liu lian lin liang ling
g ga ge gai gei gao gou gan gen gang geng
k ka ke kai kao kou kan ken kang keng
h ha he hai hei hao hou han hen hang heng
j ji jia jie jiao jiu jian jin jiang jing
q qi qia qie qiao qiu qian qin qiang qing
x xi xia xie xiao xiu xian xin xiang xing
zh zha zhe zhai zhei zhao zhou zhan zhen zhang zheng
ch cha che chai chao chou chan chen chang cheng
sh sha she shai shei shao shou shan shen shang sheng
r rerao rou ran ren rang reng
z za ze zai zei zao zou zan zen zang zeng
c ca ce cai cao cou can cen cang ceng
s sa se sai sao sou san sen sang seng
y ya yao you yan yang
w wa wo wai wei wan wen wang weng
package zhidaoimport java.io.File
import java.util.LinkedList
import java.util.Scanner
public class Roobit
{
public static void main ( String[] args ) throws Exception
{
LinkedList<String> hosts = new LinkedList<String> ()
Scanner scanner = new Scanner (new File ("hosts.txt"))
String regex = "^host[\\s\\=]+[^\r\n]+$"
while (scanner.hasNextLine ())
{
String line = scanner.nextLine ()
if (line.matches (regex))
{
hosts.add (line)
}
}
scanner.close ()
for ( String string : hosts )
{
System.out.println (string)
}
}
}
用工具栏Scanner,里面的正则筛选构造函数即可,一下就可以读到host信息
欢迎分享,转载请注明来源:夏雨云
评论列表(0条)