printable_ascii: Detect the presence of non-printable or non-ascii characters

Description Usage Arguments Details Value Examples

View source: R/utils.R

Description

Detect the presence of non-printable or non-ascii characters

Usage

1

Arguments

x

a character vector

Details

Printable ASCII characters consist of space, A-Z, a-z, 0-9 and the characters

! "" # $ % & ' ( ) * + , . / : ; < = > ? @ [ ] \ ^ _ ` { | } ~ -

Note that this excludes tab (as it is a control character).

Value

A logical indicating which elements consist solely of printable ASCII characters.

Examples

1
2
3
4
5
6
7
8
# define o-umlaut
ouml <- intToUtf8("0x00F6")
x <- c("Motorhead", paste0("Mot",ouml,"rhead"))
# second element contains a non-ascii character
printable_ascii(x)

# Control characters (like carriage return) are also excluded
printable_ascii("abc\r")

stringdist documentation built on Sept. 9, 2021, 5:08 p.m.