strReplance remove linebreaks
- PuzzledGreatly
- Posts: 1303
- Joined: 29 Sep 2013, 22:18
strReplance remove linebreaks
I have a text file with one word a line. How to change the selected text so that I end up with one line with the words separated by a comma and a space. I've tried doing a strReplace using "`n" but although I can add commas and spaces I can't remove the actual linebreaks so I still end up with one word a line. How to remove the linebreaks, thanks.
- divanebaba
- Posts: 805
- Joined: 20 Dec 2016, 03:53
- Location: Diaspora
Re: strReplance remove linebreaks
Hi.
As StrReplace(...) turns back a value, you have to assign this to a variable as shown below:Maybe you have to delete all `r if they are present. Then you can combine like below:
As StrReplace(...) turns back a value, you have to assign this to a variable as shown below:
Code: Select all
myText := strReplace(myText, "`n", "`,")
Code: Select all
myText := strReplace(strReplace(myText, "`n", "`,"), "`r")
Einfach nur ein toller Typ.
Re: strReplance remove linebreaks
- Try this perhaps:
- To investigate the text you can try this:
Code: Select all
vText := "a`r`nb`r`nc"
MsgBox, % vText
vText := StrReplace(vText, "`r`n", ", ")
MsgBox, % vText
Code: Select all
vText := "a`r`nb`r`nc"
vText := StrReplace(vText, "`r", "_R")
vText := StrReplace(vText, "`n", "N_")
MsgBox, % vText
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
- PuzzledGreatly
- Posts: 1303
- Joined: 29 Sep 2013, 22:18
Re: strReplance remove linebreaks
Thanks for the replies, jeewg had the solution. Putting `r and `n together did the trick.
Who is online
Users browsing this forum: Google [Bot] and 305 guests