Utility functions for checking formats and alignments.
Arguments
- x
(
stringorfunction)
format string or an object returned bysprintf_format()- stop_otherwise
(
flag)
whether an error should be thrown ifxis not a valid format.- algn
(
character)
a character vector that indicates the requested cell alignments.
Value
is_valid_formatreturnsTRUEifxisNULL, a supported format string, or a function, andFALSEotherwise.
check_alignsreturnsTRUEif the provided alignments are supported, otherwise, an error is thrown.
Examples
is_valid_format("xx.x")
#> [1] TRUE
is_valid_format("fakeyfake")
#> [1] FALSE
check_aligns(c("decimal", "dec_right"))