Sign in to follow this  
Followers 0
atomman

StringReplace() and @CRLF

4 posts in this topic

why doesn't this work? it doesn't replace the linefeeds/returns with ".".

saw another example here that does exactly the same thing, and it works. also tried StringRegExpReplace() with "\n".

If StringInStr($str, @CRLF) Then StringReplace($str, @CRLF, ".")oÝ÷ Ù©e¡ø­jëh×6$str = FileRead(@ScriptDir & "\test.txt")
MsgBox(0,"string is...",$str)
If StringInStr($str, @CRLF) Then
    MsgBox(0,"does it have returns?","ya")
    StringReplace($str, @CRLF, ".")
    MsgBox(0,"error in StringReplace?",@error)
EndIf
MsgBox(0,"new string",$str)

Share this post


Link to post
Share on other sites

why doesn't this work? it doesn't replace the linefeeds/returns with ".".

saw another example here that does exactly the same thing, and it works. also tried StringRegExpReplace() with "\n".

StringInStr doesn't change the variable passed to it, it returns the altered string.

So you need

If StringInStr($str, @CRLF) Then 
 $str = StringReplace($str, @CRLF, ".")
endif

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

oh jeez!

i better lock myself in a closet.

thanks martin!

Share this post


Link to post
Share on other sites

oh jeez!

i better lock myself in a closet.

thanks martin!

NP.

Don't worry about a mistake like that, the name suggests that it's going to do what you thought.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
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
Sign in to follow this  
Followers 0