filename_strip_illegal_characters: from filename minus extension, replace illegal characters...

View source: R/util_files.R

filename_strip_illegal_charactersR Documentation

from filename minus extension, replace illegal characters (allowed are alphanumeric, underscore and dash)

Description

from filename minus extension, replace illegal characters (allowed are alphanumeric, underscore and dash)

Usage

filename_strip_illegal_characters(f, strict = FALSE, replacement = "_")

Arguments

f

f can either be a filename or a full path

strict

boolean, if TRUE; only allow alphanumeric, underscore and '-'

replacement

string replacement value for removed characters

Examples

## Not run: 
  # nothing to do
  filename_strip_illegal_characters("test.txt")
  filename_strip_illegal_characters("C:/temp/test.txt")
  # fix filename
  filename_strip_illegal_characters("C:/temp/test !~: file.txt", strict = F)
  # example emphasizes that this function only applies to filename
  filename_strip_illegal_characters("C:/temp/this is ok/not ok.txt", strict = T)

## End(Not run)

ftwkoopmans/msdap documentation built on March 5, 2025, 12:15 a.m.