I have a custom function which converts a path with backslashes on the clipboard to one with forward slashes and pastes it back onto the clipboard. The trouble is, when it is pasted back, it comes with a newline. I can't seem to find where this newline has come from as it doesn't seem to be a newline character as such:
btf <- function(){
backstring <- readClipboard()
forstring <- gsub("\\\\", "/", backstring)
writeClipboard(forstring)
}
So to use a sample path: C:\path\to\folder
1. copy path
2. run btf()
in R
3. paste
The pasted copy now has a newline after it. I'm running R 3.0.1 under Windows 7.
How can I prevent this newline from appearing?
USE:
btf <- function(){
backstring <- readClipboard()
forstring <- gsub("\\\\", "/", backstring)
writeClipboard(charToRaw(paste0(forstring, ' ')))
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With