is.DBCS {lazy.tools}R Documentation

Checks if the Characters in a String are Double Byte Characters.

Description

Checks if the Characters in a String are Double Byte Characters.

Checks if the Characters in a String are Double Byte Characters.

Usage

is.DBCS(x)

is.DBCS(x)

Arguments

x

String vector

x

String vector

Details

About rawToChar and charToRaw functions:
To get the raw expression of character, use
raw <- charToRaw(paste(c(0:9," ",letters,LETTERS),collapse=""))
To get the numeric equivalent of raw, use
num <- as.numeric(raw) .
To recover the original characters, use
char <- rawToChar( as.raw(num) ) .

About rawToChar and charToRaw functions:
To get the raw expression of character, use
raw <- charToRaw(paste(c(0:9," ",letters,LETTERS),collapse=""))
To get the numeric equivalent of raw, use
num <- as.numeric(raw) .
To recover the original characters, use
char <- rawToChar( as.raw(num) ) .

Value

A logical vector or list of logical vectors indicating if each character in the input string vector is a double byte chractor or not.

A logical vector or list of logical vectors indicating if each character in the input string vector is a double byte chractor or not.

Examples


# A string consisting of single and double byte characters
# The 3rd, 6th and 7th characters are double byte characters.
nza <- c(97,98,130,131,100,101,130,134,130,135,104)
za <- rawToChar(as.raw(nza))

# location of the double byte characters in a string
is.DBCS(za)

# Pick up the single byte characters.
strsplit(za,"")[[1]][!is.DBCS(za)]


# A string consisting of single and double byte characters
# The 3rd, 6th and 7th characters are double byte characters.
nza <- c(97,98,130,131,100,101,130,134,130,135,104)
za <- rawToChar(as.raw(nza))

# location of the double byte characters
is.DBCS(za)

# The single byte characters.
strsplit(za,"")[[1]][!is.DBCS(za)]


[Package lazy.tools version 0.1.3 Index]