Placing a line on the clipboard without a new line

I have a custom function that converts a backslash path to the clipboard into one using a slash and pastes it back into the clipboard. The problem is that when it is inserted back, it comes with a new line. It seems I can not find where this new line came from, because it does not look like a new line character:

btf <- function(){ backstring <- readClipboard() forstring <- gsub("\\\\", "/", backstring) writeClipboard(forstring) } 

So, to use the sample path: C:\path\to\folder
1. copy of the path
2. Run btf() in R
3. insert

After that, a new line appeared in the copied copy. I am running R 3.0.1 under Windows 7.
How can I prevent this line from appearing?

+4
source share
1 answer

USING:

 btf <- function(){ backstring <- readClipboard() forstring <- gsub("\\\\", "/", backstring) writeClipboard(charToRaw(paste0(forstring, ' '))) } 
+3
source

Source: https://habr.com/ru/post/1486529/


All Articles