% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/class.r
\name{suppr-predicates}
\alias{suppr-predicates}
\alias{is.boolean}
\alias{is.string}
\alias{nzstring}
\title{Value Predicates for Common Object Types}
\usage{
is.boolean(x)

is.string(x)

nzstring(x)
}
\arguments{
\item{x}{an object to be tested.}
}
\value{
\code{TRUE} or \code{FALSE}.
}
\description{
\code{is.boolean} checks if an object is a single (non-NA) logical value
(\code{TRUE} or \code{FALSE}).

\code{is.string} checks if an object is a single (non-NA) character string.

\code{nzstring} checks if an object is a single (non-NA) non-empty character
string.
}
\details{
The \code{string} helpers differ slightly from what you \emph{may} expect
from base \strong{R} as \code{NA_character_} is not considered a string.
For example:

\if{html}{\out{<div class="sourceCode r">}}\preformatted{nzchar(NA_character_)
#> [1] TRUE
is.string(NA_character_)
#> [1] FALSE
nzstring(NA_character_)
#> [1] FALSE
}\if{html}{\out{</div>}}
}
\examples{
is.boolean(TRUE)
is.boolean(NA)

is.string("hello")
is.string(NA_character_)
is.string("")

nzstring("")
}
