Jump to content

String replace


yucatan
 Share

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

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...