Teki
Rules

Trim

Normalize string values by trimming surrounding whitespace.

Use trim() to remove surrounding whitespace from a string value.

Teki schema = Teki.fromRules(
    string("email").required().email().trim()
);

schema.validate(request);

If validation succeeds, Teki writes the trimmed value back to the field.

Available on

  • string(...)

Annotation equivalent

import dev.ditsche.teki.annotation.Trim;

public class SignupRequest {
    @Trim
    private String email;
}

On this page