Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can assertCharacter be used to check for non allowed symbols in string? #232

Open
emantzo opened this issue Aug 18, 2022 · 1 comment
Open

Comments

@emantzo
Copy link

emantzo commented Aug 18, 2022

Hi!
How could I use assertCharacter to check if a string contains any element that is not allowed?
For example , I want to make sure that the string vector contains only letters.

Is it possible?
Thank you!

@tdeenes
Copy link
Contributor

tdeenes commented Aug 19, 2022

See the pattern argument, e.g.:

checkmate::assert_character(c("a", "a123"), pattern = "^[[:alpha:]]+$")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@tdeenes @emantzo and others