strmlen: "Safe" String Manipulation Functions

Description Usage Arguments Details Value

Description

Implements variants of strlcpy, strnlen, etc.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
strmlen(str, maxlen = 10000L)

strmcpy(str, maxlen = 10000L)

smprintf2(format, a, b, maxlen = 10000L)

ucfirst(str, maxlen = 10000L)

lcfirst(str, maxlen = 10000L)

strbullet(str, bullet = "- ", ctd = "  ", maxlen = 10000L)

collapse(str, sep = "", maxlen = 10000L)

Arguments

str

character string to measure or manipulate, should be scalar for strmlen and strmcpy

maxlen

integer(1L) size limit to truncate to, or to limit tokens to

format

character(1L) string to use as format template

a

character(1L) another string

b

character(1L) another string

bullet

character(1L) a string to use as the bullet symbol

ctd

character(1L) a string preferably the same number of characters as bullet to use after the first line wraps in a bullet

sep

character(1L) a separator to use when collapsing character vectors with collapse

Details

These functions are intended to be used directly from C but are exposed here for testing purposes. They differ from similar existing versions in these respects:

Function specific details follow. Pay attention, the interfaces are not exactly the same as the C functions they intend to replace. For example smprintf does not have a str parameter like snprintf, and strmcpy returns a new character string instead of modifying one passed as an argument.).

Value

integer(1L) for strmlen, character(1L) for strmcpy and smprintf2


brodieG/cstringr documentation built on May 13, 2019, 7:45 a.m.