Page 1 of 1

Handling a solitary linefeed (`n) in the Edit control

Posted: 19 Apr 2019, 08:33
by afe
Hello,

When I paste text containing a solitary linefeed (`n), `r`n pairs is not produced inside the Edit control.
In other words, it won't appear as multiple lines.
How to do If I treat the text after (`n) as the same row or can make it appear as multiple lines?

Such as

Code: Select all

a `nb`r`n                      ; The first row after pasting
cd
I want to treat "a b" as one row and "cd" as another row.
I save it to a variable x with "Gui Submit" and split it using "Loop, Parse, x, `n".

But at this time the value of x will be

Code: Select all

a `nb`n
cd
x[1] = a
x[2] = b
x[3] = cd

I expect to be
x[1] = a b
x[2] = cd

Any good suggestions?

Re: Handling a solitary linefeed (`n) in the Edit control

Posted: 19 Apr 2019, 09:15
by Odlanir

Code: Select all

str :="a `nb`r`nCd"
MsgBox % RegExReplace(str, "`n")

Re: Handling a solitary linefeed (`n) in the Edit control

Posted: 19 Apr 2019, 09:28
by afe
But when the Edit control is saved to str via Gui Submit , each `r`n will be translated to a `n.