Validation
(see ValidationExample.java)
A few types can be validated. For numbers, for example, the default is to check whether the input is a number:
@Entrypoint
public void run(@Prompt("Number of iterations") final int number) {
for (int i = 0; i < number; i++) {
System.out.println(i);
}
}
[int] Number of iterations > Test
🦑 [wrap-error] For input string: "Test"
[int] Number of iterations > 2
// OK! ...
@Range
The size of numbers, the length of strings, and the capacity of arrays can be limited with the @Range
-annotation:
@Pattern
Strings can be validated with a regular expression using the @Pattern
-annotation:
@Transform
Strings can additionally be transformed with the @Transform
-annotation, e.g. UPPER_CASE, lower_case and desreveR:
Last update:
2022-03-15