Jump to content

How to remove new line ?


Recommended Posts

I figured how to add new line using @crlf

but how to remove it using stringreplace ?

stringreplace ($string,@crlf,'') ? or what?

If so i want to make sure i remove that for the correct line.

Any ideas ?

I think i can count what line would neet to be removed, but how to remove it i have no clue

PLease help.

Thanks in advance

Link to comment
Share on other sites

If you want to replace double @CRLF with single @CRLF, use:

$string = "xxx"&@CRLF&"yyy"&@CRLF&@CRLF&"zzz"
MsgBox(0,"Before",$string)
$string = StringReplace($string,@CRLF&@CRLF,@CRLF)
MsgBox(0,"After",$string)

For more than 2 @CRLF, use StringRegExpReplace(a bit advanced):

$string = "xxx"&@CRLF&"yyy"&@CRLF&@CRLF&@CRLF&"zzz"
MsgBox(0,"Before",$string)
$string = StringRegExpReplace($string,"(\r\n)(\1)+","\1")
MsgBox(0,"After",$string)

Hi ;)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...