Learn R Programming

rapport (version 0.51)

tocamel: CamelCase

Description

Convert character vector to camelcase - capitalise first letter of each word.

Usage

tocamel(x, delim = "[^[:alnum:]]", upper = FALSE,
    sep = "", ...)

Arguments

x
a character vector to be converted to camelcase
delim
a string containing regular expression word delimiter
upper
a logical value indicating if the first letter of the first word should be capitalised (defaults to FALSE)
sep
a string to separate words
...
additional arguments to be passed to strsplit

Value

  • a character vector with strings put in camelcase

Examples

Run this code
tocamel("foo.bar")
    ## [1] "fooBar"

    tocamel("foo.bar", upper = TRUE)
    ## [1] "FooBar"

    tocamel(c("foobar", "foo.bar", "camel_case", "a.b.c.d"))
    ## [1] "foobar"    "fooBar"    "camelCase" "aBCD"

Run the code above in your browser using DataLab