Good day. I would like to know how do I include quotes in a text sting when I'm trying to save the text to a variable. example:-
MyStringVar[70]= "I said "That the string component won't accept a statement with quotes in it.""
Ondra
Quotes in variables
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Quotes in variables
Hello Ondra
To do this you will have to assign the ascii numeric value for the " character.
MyStringVar[70] = 34
To do this you will have to assign the ascii numeric value for the " character.
MyStringVar[70] = 34
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: Quotes in variables
Using the example above, are you saying that I can place 34 in place of the quotes an it will print out as ".
So then this : - MyStringVar[70] = "I said 34 That the string component won't accept a statement with quotes in it.34"
would print out as this :- I said "That the string component won't accept a statement with quotes in it."
Ondra
So then this : - MyStringVar[70] = "I said 34 That the string component won't accept a statement with quotes in it.34"
would print out as this :- I said "That the string component won't accept a statement with quotes in it."
Ondra
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Quotes in variables
Hello Ondra
No you cannot include the number 34 inside the speechmarks or it will be interpreted as the ascii chars for 3 and 4. You must do the following to assign the value to a string.
example_String = " Hello "
example_String[0] = 34
example_String[6] = 34
would provide the string "Hello"
If you are wishing to send the quote characters over the RS232 then its probably easier to use 3 send macros.
Eg
RS232_Send 34
RS232_Send "Hello" or example_String
RS232_Send 34
No you cannot include the number 34 inside the speechmarks or it will be interpreted as the ascii chars for 3 and 4. You must do the following to assign the value to a string.
example_String = " Hello "
example_String[0] = 34
example_String[6] = 34
would provide the string "Hello"
If you are wishing to send the quote characters over the RS232 then its probably easier to use 3 send macros.
Eg
RS232_Send 34
RS232_Send "Hello" or example_String
RS232_Send 34
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Steve
- Matrix Staff
- Posts: 3433
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
Re: Quotes in variables
You might be able to use "escape sequences" using the backslash character, like this:
Code: Select all
example_String = "\"Hello\""
Re: Quotes in variables
Thanks for going the extra on this Steve. I thought I saw something like that somewhere.
Ondra
Ondra