Files
uni-ba-socialagenda/functions.R
T
2014-11-29 21:41:28 +01:00

9 lines
370 B
R

require(stringr)
# Replace characters messing up JSON validation (\,\n,^)
correctJSON <- function(string) {
string <- str_replace_all(string, pattern = perl('\\\\(?![tn"])'), replacement = " ")
string <- str_replace_all(string, pattern = fixed("\n"), replacement = " ")
string <- str_replace_all(string, pattern = fixed("^"), replacement = " ")
return(string)
}