Skip to content

Commit 2e9b8c2

Browse files
committed
inline firstUpper()
1 parent 15241a6 commit 2e9b8c2

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

R/utilities.R

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,9 @@ toupper <- function(x) {
257257
# Convert a snake_case string to camelCase
258258
camelize <- function(x, first = FALSE) {
259259
x <- gsub("_(.)", "\\U\\1", x, perl = TRUE)
260-
if (first) x <- firstUpper(x)
260+
if (first) {
261+
x <- paste0(to_upper_ascii(substring(x, 1, 1)), substring(x, 2))
262+
}
261263
x
262264
}
263265

@@ -268,10 +270,6 @@ snakeize <- function(x) {
268270
to_lower_ascii(x)
269271
}
270272

271-
firstUpper <- function(s) {
272-
paste0(to_upper_ascii(substring(s, 1, 1)), substring(s, 2))
273-
}
274-
275273
snake_class <- function(x) {
276274
snakeize(class(x)[1])
277275
}

0 commit comments

Comments
 (0)