🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

Adding literal single quotes to a string

User: "andyer"
Altair Employee
Updated by andyer

Hi all,

 

I would like to add literal single quotes to a string, e.g. the end results of the string output should look like:

 

'this is the string'.

 

For example, in Octave you might do this like this with escape characters and double quotes:

my_var = "\'this is the string\'"

I don't believe this is supported directly in Compose, but is there any other way this possible to add literal single string characters in Compose?

Thanks!

Best - Andy

Find more posts tagged with

Sort by:
1 - 1 of 11
    User: "RSGarciarivas"
    Altair Employee
    Accepted Answer
    Updated by RSGarciarivas

    You're right! In previous versions you can use two single quotes, but I also get an error in 2022.3. Thanks for noticing that. My other way of doing it is:

    [char(39), 'this is the string', char(39)]