I searched for a function that does that for quite a while but to no avail. But, using the strsplit & paste functions, one can do it like this:
streplace <- function(string, searchterm, replacestring) {
string <- paste(strsplit(string,paste("[",searchterm,"]", sep=""))[[1]], collapse=replacestring);
return(string);
}
With the usage for example: htmlstring = streplace(mytext, "ä", "ä")
Keine Kommentare:
Kommentar veröffentlichen