Learn R Programming

lettercase (version 0.13.1)

str_is: Test whether strings are of the specified type

Description

Family of functions for testing whether strings are of the specified type.

Usage

str_is(string, type, autostart = 30L)
str_is_all(...)
make_str_is(type)
make_str_are(type)
str_are_uppercase(string)
str_are_upper_case(string)
str_are_uppercase(string)
str_are_upper_case(string)

Arguments

string
vector. This must be an atomic vector, and will be coerced to a character vector
type
function that transforms the string to type
autostart
integer; number of elements to test before concluding that string is of the suggested type. (Default: 30)
...
arguments passed to subsequent functions

Value

For str_is a logical vector indicating which entries of string are of the specified type,For str_is_all and str_are a logical vector of length one indicating whether all of string is of the specified type(s)For make_str_is and make_str_are functions that return functions that accept a single argument and return whether the string is of the specified types.

Details

str_is determines if the string belongs to one of the supported lettercase types. Comparisons are made by comparing the original string to a transformed version of the string. If the two are identical, then the functions are equivalent.

autostart determines the maximum number of values

make_str_is and make_string_are are metafunctions that return functions that test for the given lettercase types.

See Also

str_transform make_str_replace make_str_delete

Examples

Run this code
string = c( "catch-22", "finnegans wake" )
  str_is( string, str_lower_case )

  str_transform( string, str_capitalize, str_delete_nonword )
  str_delete_nonword( str_capitalize( string ) )      # SAME

  # magrittr:
  ## Not run: 
#     string %>% str_capitalize %>% str_delete_nonword   # SAME
#   ## End(Not run)

Run the code above in your browser using DataLab