Page 1 of 1

Remove line breaks

Posted: Jun 22nd, ’22, 02:53
by kmaustral
I can't seem to find this function in the Library or Forum.

It's a matter of replacing line breaks with a space. This would transform a paragraph of broken sentences as normally found in a PDF to a continuous flow of words.

Ideally, it keeps paragraphs, which are usually double line breaks.

Any ideas? :roll:

Re: Remove line breaks

Posted: Jun 24th, ’22, 14:02
by Marko
This replaces all line breaks in the selected text with spaces (tries to preserve double breaks):

Code: Select all

Clipboard:=""
Send, ^c
ClipWait
string:=clipboard
stringreplace, string, string, `r`n`r`n, ♥, all
stringreplace, string, string, `r`n, %A_Space%, all
stringreplace, string, string, ♥, `n`n, all
SendInput, % string

Re: Remove line breaks

Posted: Jul 1st, ’22, 06:24
by kmaustral
Thank you so much!