Wmisc (version 0.3.4)

Strings: Head and Tail functions for Strings.

Description

C++ implemetations of convenience functions for strings. All functions but strTake operate with O(1) memory.

strHead returns the first character of a string

strHeadLower returns the first character of a string coerced to lower case

strTail returns all but the first character of a string

strTake returns the first n characters of a string

strDrop returns all but the first n characters of a string

Usage

strHead(s)
strHeadLower(s)
strTail(s)
strTake(s, n)
strDrop(s, n)

Arguments

s

a string object

n

the number of characters to take or drop

Value

A character vector.

Details

A few convenient list operations, tailored to 8-bit-character strings.

Examples

Run this code
# NOT RUN {
strHead("Gnu")
strHeadLower("Gnu")
strTail("Gnu")
strTake("Gnus and Gnats",3)
strDrop("Gnus and Gnats",9)
# }

Run the code above in your browser using DataCamp Workspace