Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class CodeWordChecker implements StringChecker
- {
- private int min;
- private int max;
- private String notOccur;
- public CodeWordChecker(int min, int max, String notOccur)
- {
- this.min = min;
- this.max = max;
- this.notOccur = notOccur;
- }
- public CodeWordChecker(String notOccur)
- {
- min = 6;
- max = 20;
- this.notOccur = notOccur;
- }
- public boolean isValid(String str)
- {
- return (str.length() >= min) && (str.length <= max) && (str.indexOf(notOccur) == -1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment