AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

need script to remove line break

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
jitendravyas



Joined: 06 Mar 2010
Posts: 15
Location: India

PostPosted: Tue Mar 16, 2010 6:50 pm    Post subject: need script to remove line break Reply with quote

I need AHK script to remove line breaks from blocks of text but preserve paragraph breaks.

same like this tool

http://www.textfixer.com/tools/remove-line-breaks.php
Back to top
View user's profile Send private message
MasterFocus



Joined: 08 Apr 2009
Posts: 3035
Location: Rio de Janeiro - RJ - Brasil

PostPosted: Tue Mar 16, 2010 7:06 pm    Post subject: Reply with quote

Something like this?
Code:
NewString := RegExReplace(OldString,"\s+"," ")

_________________
"Read the manual. Read it again. Search the forum.
Try something before asking. Show what you've tried.
"

Antonio França
My stuff: Google Profile
Back to top
View user's profile Send private message Visit poster's website
maxgohan



Joined: 09 Oct 2009
Posts: 81

PostPosted: Wed Mar 17, 2010 2:17 pm    Post subject: Reply with quote

you can do it with a StringReplace however i don't know what the value is for line breaks

Quote:

; Replace all spaces with pluses:
StringReplace, NewStr, OldStr, %A_SPACE%, +, All
Back to top
View user's profile Send private message
maxgohan



Joined: 09 Oct 2009
Posts: 81

PostPosted: Wed Mar 17, 2010 2:25 pm    Post subject: Reply with quote

k it should be something like

Quote:

StringReplace, NewStr, OldStr, `r`n, , All


try that
Back to top
View user's profile Send private message
OceanMachine



Joined: 15 Oct 2007
Posts: 780
Location: England

PostPosted: Wed Mar 17, 2010 2:53 pm    Post subject: Reply with quote

Not the most elegant solution, but try the below. It seems to have the same results as that tool you linked for me.

Code:
String =
(
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam elementum ipsu
murna. Maecenas adipiscing, odio at commodo sollicitudin, turpis nisl pellent
esque nisl, a semper erat tellus sed tortor. Vivamus turpis dui, varius in eg
estas sit amet, vulputate a augue. Nam vulputate diam vel nisl faucibus laore
et aliquam leo aliquet.

Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac
turpis egestas. Pellentesque habitant morbi tristique senectus et netus et ma
lesuada fames ac turpis egestas. Sed sed augue lectus. In condimentum convall
is elit, ut tempus quam ullamcorper id.

Proin eget varius nibh. Nunc tincidunt convallis pharetra. Nunc viverra tellu
s in libero consectetur pharetra tempus felis posuere. Donec consequat pellen
tesque laoreet. Proin rhoncus magna rhoncus nibh tristique fermentum.
)

MsgBox, BEFORE`n`n%String%

StringReplace, String, String, `n`n,||,All
StringReplace, String, String, `n,, All
StringReplace, String, String, ||,`n`n,All

MsgBox, AFTER`n`n%String%
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group