How to make an app - Andromo App Maker

Announcement

Collapse
No announcement yet.

Change/Replace string that contains "" characters?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Change/Replace string that contains "" characters?

    Hi,

    I am a noob that can't seem to figure out how to replace text within an xml file that contains "" characters. I will give an example:

    Here are a couple lines from the file:

    vlookatmin=""
    vlookatmax=""

    I want to search and replace this line:

    vlookatmax=""

    with this added information

    vlookatmax="42"

    However I am receiving an error in the script because of the "".

    Here is the code I have been working on:

    -- Find and replace the text
    SourceFile = TextFile.ReadToString("C:\\test\\vtour\\tour.xml")
    SourceFile = String.Replace(SourceFile, "vlookatmax=""", "vlookatmax="42"", false);

    -- Save the file
    TextFile.WriteFromString("C:\\test\\vtour\\tour3.x ml", SourceFile, false)

    Any help would be greatly appreciated....I have been at it for 10 hours :-)
    Thank You!

  • #2
    You need to escape the double quotes with single quotes. ie.
    Code:
    SourceFile = String.Replace(SourceFile, 'vlookatmax=""', 'vlookatmax="42"', false);

    Comment

    Working...
    X