package jsystem.extensions.analyzers.text;
public class FindText extends AnalyzeTextParameter {
protected boolean isRegExp = false;
public FindText(String toFind) {
this.toFind = toFind;
}
public FindText(String toFind, boolean isRegExp) {
this(toFind);
this.isRegExp = isRegExp;
}
public void analyze() {
message = testText;
if (testText == null) {
title = "Text to analyze is null";
status = false;
}
if (isRegExp) {
status = testText.matches(".*" + toFind + ".*");
} else {
status = (testText.indexOf(toFind) > 0);
}
if (status) {
title = "The text: >" + toFind + "< was found";
} else {
title = "The text: >" + toFind + "< wasn't found";
}
}
}
|