Nesting quotation marks - help please

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • NikkoW

    #1

    Nesting quotation marks - help please

    I need to assign a string to a variable but the text string includes quotation marks:

    Example: MyString = "He turned and said "Hello" before leaving."

    When the compiler hits the quotation marks in front of Hello, it assumes the string is over and generates and error on the remainder. I must use the double quotes " in my string and not the single ' so that isn't an option.

    How can I avoid this?

    Thanks in advance from a noob thrasher!

    Nick
  • Auric__

    #2
    Re: Nesting quotation marks - help please

    On Thu, 29 Apr 2004 02:16:58 GMT, NikkoW wrote:
    [color=blue]
    >I need to assign a string to a variable but the text string includes quotation marks:
    >
    >Example: MyString = "He turned and said "Hello" before leaving."
    >
    >When the compiler hits the quotation marks in front of Hello, it
    >assumes the string is over and generates and error on the remainder.
    >I must use the double quotes " in my string and not the single ' so
    >that isn't an option.
    >
    >How can I avoid this?
    >
    >Thanks in advance from a noob thrasher!
    >
    >Nick[/color]

    Turn off HTML posting. In OE:
    Tools menu -> Options -> Send tab -> News Sending Format: Plain Text

    As for your problem: the compiler doesn't "assume" anything - your code
    explicitly tells it that the text is over after "said ". When inside a
    string, simply double the quotes:
    MyString = "He turned and said ""Hello"" before leaving."
    --
    auric "underscore " "underscore " "at" hotmail "dot" com
    *****
    And now, some new news.

    Comment

    Working...