Jump to content
Sign in to follow this  
yucatan

String replace

Recommended Posts

yucatan

hello guys i have a string my string = "rsync -vrtz --delete --progress /cygdrive/c/Documents and Settings/tw/test/ 127.0.0.1::asecretpwd"

i wanne make a check

if this is in the string:Documents and Settings

then i wanne change it into'Documents and Settings'

so the string is:"rsync -vrtz --delete --progress /cygdrive/c/Documents and Settings/tw/test/ 127.0.0.1::asecretpwd"

i wanne change it into:"rsync -vrtz --delete --progress /cygdrive/c/'Documents and Settings'/tw/test/ 127.0.0.1::asecretpwd"

can somebody help me on this? pleas

Share this post


Link to post
Share on other sites
99ojo

Hi,

$string = "rsync -vrtz --delete --progress /cygdrive/c/Documents and Settings/tw/test/ 127.0.0.1::asecretpwd"
If StringInStr ($string, "Documents and Settings") Then
    $string = StringLeft ($string, StringInStr ($string, "/Documents and Settings") ) & Chr (34) & "Documents and Settings" & Chr (34) & _
    StringMid ($string, StringInStr ($string, "/Documents and Settings") + 23)
    MsgBox (0,"",$string)
EndIf

I guess that a StringRegExp Guru will jump the train as well...

;-))

Stefan

Share this post


Link to post
Share on other sites
Mat

StringReplace ($sString, "Documents and Settings", "'Documents and Settings'")

is that it? that looks a bit simpler than what you had :)

Mat

Share this post


Link to post
Share on other sites
99ojo

StringReplace ($sString, "Documents and Settings", "'Documents and Settings'")

is that it? that looks a bit simpler than what you had :)

Mat

Hi Mat,

i tried that as well and did a beginner mistake. I have had no replace because of faulty code.

So i come up to my solution.

Open eyes now......

;-))

Stefan

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  

×