首页>代码>java实现文件夹搜索指定字符串软件>/文件夹查找字符串/find_text/ReadFileChild.java
package find_text;

public class ReadFileChild extends ReadFile {
	private String text;
	private boolean zhiChiRegex;
	public ReadFileChild(String text) {
		super();
		this.text = text;
		this.zhiChiRegex = true;
	}
	public ReadFileChild(String text, boolean zhiChiRegex) {
		super();
		this.text = text;
		this.zhiChiRegex = zhiChiRegex;
	}


	public ReadFileChild() {
	}

	@Override
	public String chuLi(String str) {
		rowNum++;
		if(zhiChiRegex){//提供了对正则表达式的支持
			if(str.matches(text)||true){
				System.out.println(str+"+++==="+text);
				System.out.println(fileName+"  第"+rowNum+"行:  "+str);
				return rowNum+"";
			}
			//return null;
		}else{
			if(str.contains(text)){
				System.out.println(fileName+"  第"+rowNum+"行:  "+str);
				return rowNum+"";
			}
			//return null;
		}
		return null;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}
}
最近下载更多
977903096  LV10 2020年4月23日
tangjun  LV17 2018年6月19日
五只大老虎  LV3 2017年9月12日
scpcyzxb  LV16 2017年8月14日
wgtgt  LV24 2014年7月15日
最代码官方  LV167 2013年11月6日
最近浏览更多
笑得很美  LV11 2022年9月15日
小哥一起飞天吗 2022年3月10日
暂无贡献等级
beibei2020  LV12 2021年12月1日
Altria  LV5 2021年8月13日
maki666  LV1 2021年4月21日
MIAOHUA  LV6 2021年3月7日
18238687719  LV1 2021年1月10日
813405250  LV5 2021年1月2日
llxxww  LV2 2020年11月12日
laputa 2020年9月18日
暂无贡献等级
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友