Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rawToCharNull

Convert raw vectors into a character string


Description

A function that converts raw data into a character string.

Usage

rawToCharNull(raw_dat)

Arguments

raw_dat

A vector of class raw to be converted into a character.

Details

The function rawToChar will fail on vectors of raw data with embedded 0x00 data. This function will not fail on embedded 0x00 values. Instead, it will replace embedded 0x00 data with white spaces. Note that leading and trailing 0x00 data will be omitted from the result.

Value

A character string based on the raw data

Author(s)

Pepijn de Vries

See Also

Other character.operations: as.character(), name, periodToChar(), sampleRate

Examples

## generate some raw data with an embedded 0x00:
some.raw.data <- as.raw(c(0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x00,
                          0x77, 0x6f, 0x72, 0x6c, 0x64, 0x21))
## Not run: 
## this will fail:
try(rawToChar(some.raw.data))

## End(Not run)

## this will succeed:
rawToCharNull(some.raw.data)

ProTrackR

Manipulate and Play 'ProTracker' Modules

v0.3.7
GPL-3
Authors
Pepijn de Vries [aut, cre, dtc]
Initial release
2020-02-03

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.