I am trying to use a block of text I copied from somewhere as a string in studio. The problem is that the text contains quotes, which I cannot edit or remove. I know that if you want quotes within a string to treated as part of the string, you have to use double quotes.
For example, if I want my output string to be mystring “123”, I can write it in studio as "mystring ““123"””.
But since I cannot edit the text and add the extra quotes inside the string, is there any way to make studio understand that I want the whole text block (including any quotes inside it) to be treated as one string?
I tried different things, like "“mystring “123"”” but haven’t found a solution yet.
The options you shared would normally be very helpful, but I was wondering if there is a way to only work with the ends of the string, assuming I can’t edit the quotes around 123. The text i need to use as string is copied from somewhere, and it contains quotations in several places, so I would like to avoid having to make changes in it.
For example, if I wanted to do this in python, to get the output as mystring “123”, my input would be 'mystring “123” ', thereby only manipulating the ends of the string.
If the double quotes are in the value in the string variable, they have no effect on anything. You can just use the variable like you would any other. Are you having a specific problem that you’re trying to solve?
you can use Chr(34)+your_string+Chr(34) to wrap the text with double quotes. This way you need not manipulate the actual string
and for single quotes you can use Chr(39).
hope this is helpful
Hi Paul. Yes, the double quotes are in the value of the string (around Reg. 1). They do, however, seam to have an effect as I get an error saying Compiler error(s) encountered processing expression ““183.91 ml Set mark “Reg. 1” (Issued) (Processing) (Completed)””.
End of expression expected.
If I remove the quotes around Reg. 1, then there is no issue. This string is just a sample of a longer text to be assigned to the variable, and the text contains quotes in several places. That’s why I want to find a way to avoid manipulating inside the string.
I actually did a not very elegant workaround, where I use a dialog box to ask for user input, then save it as a variable. The user input seams to always be regarded as a whole string regardless of the quotes it contains. I would have just like to avoid user input.
You mean like this?
(my sting is 183.91 ml Set mark “Reg. 1” (Issued) (Processing) (Completed))
Then I get the following error:
Compiler error(s) encountered processing expression “Chr(34)+183.91 ml Set mark “Reg. 1” (Issued) (Processing) (Completed)+Chr(34)”.
End of expression expected.
I tried to put extra quotes around the string and other manipulations but I can’t seam to fix it.