extract_function_name: Extract function name from a string

View source: R/cheers_checker.R

extract_function_nameR Documentation

Extract function name from a string

Description

Extract function name from a long string. This works by identifying "function(" in the string and then finding the operand before and splitting on that before keeping the character there.

Usage

extract_function_name(string)

Arguments

string

A string containing a function definition, this must contain the word 'function'

Value

A string containing the function name

Examples

extract_function_name("better_name <- function(x){\n more code} asfdas <- function(x){}")
extract_function_name("better_name <- function(x){\n more code}")


assertHE documentation built on June 8, 2025, 10:08 a.m.