StrProp.startsWithOneOf(...) would be very useful
- Dominant language
- Java
- Stars
- 25
- Forks
- 34
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
When you need to specify a url, it would be nice to explicitly allow it to start with "http://" or "https://".
Its possible to do that with a regex, but its a relatively common need. Similarly, to specify a set of possible input files of select types, it would be nice to specify file endings, e.g. .png, .jpg, .gif.
**Describe the solution you'd like**
Add validators that are exposed as methods like this:
- `startsWithOneOf(String[])`
- `startsWithOneOfIgnoringCase(String[])`
- `endsWithOneOf(String[])`
- `endsWithOneOfIgnoringCase(String[])`
#### Notes for Hacktoberfest
These are some relatively simple additions to some existing classes. The new validations would be added to the [StringValidator](https://github.com/eeverman/andhow/blob/main/andhow-core/src/main/java/org/yarnandtail/andhow/valid/StringValidator.java). Each type of validation is a subclass of that class and is implemented as an interclass within it.
If you are unfamiliar with the project, please look over the [AndHow Site](https://www.andhowconfig.org/) to get a basic understanding of what AndHow is, in particular, how [Properties](https://www.andhowconfig.org/user-guide/andhow-properties) are used.
For this task:
- Be sure to work from the main branch
- Add the described validators to the [StringValidator](https://github.com/eeverman/andhow/blob/main/andhow-core/src/main/java/org/yarnandtail/andhow/valid/StringValidator.java) class, following the naming conventions of that class.
- Add methods to build those classes to the [StrProp.StrBuilder](https://github.com/eeverman/andhow/blob/0effe4dac390fc8eb2ac11456017f0432fd9e340/andhow-core/src/main/java/org/yarnandtail/andhow/property/StrProp.java#L35) class. The methods added to this builder should match the names listed above, e.g. `startsWithOneOf(String[])`
- Add tests for the new code, following existing examples.
Contributor guide
Assessment
This issue has not been assessed yet.