% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/UTF8pgm.R
\name{substrDBCS}
\alias{substrDBCS}
\title{Substr Using Column Location as the Unit.}
\usage{
substrDBCS(x, start, stop = max(nchar(x, type = "byte")))
}
\arguments{
\item{x}{A string vector}

\item{start}{The first location}

\item{stop}{The last location}
}
\value{
A vector consisting of the substrings of the input vector.
}
\description{
Substr Using Column Location as the Unit.
}
\details{
This is for strictly DUOBLE byte characters. NOT for UTF-8 characters.
For strictly double byte characters, this is faster than susbtr2.

About rawToChar and charToRaw functions: \cr
To get the raw expression of a string, use\cr
\code{ raw <- charToRaw(paste(c(0:9," ",letters,LETTERS),collapse="")) }\cr
To get the numeric equivalent of a raw (vector),  use\cr
\code{ num <- as.numeric(raw) }.\cr
To recover the original string, use\cr
\code{ char <- rawToChar( as.raw(num) ) }.\cr

\cr
If the n-th byte is the beginning or the ending location of \cr
a double byte character, \code{substrDBCS(x,n,n)} is invalid.\cr
Consult \code{is.DBCS(x)} and use with caution.
}
\examples{
# The exa,ple below causes error on R 4.2.0 and above.
\dontrun{
# A string consisting of single and double byte characters
nza <- c(97,98,130,131,100,101,130,134,130,135,104)
za <- rawToChar(as.raw(nza))
Print(za)
# location of the double byte characters
is.DBCS(za)
# The first to the fourth characters
substr(za,1,4)
# The characters stored in the first to the fourth bytes of za.
substrDBCS(za,1,4)
}

}
