Quotes in Text

It says: To display quotes in a text string, use a backslash ( \ ). For example: `="This is the “\official" retail price for this item:” & variable name

But I can’t seem to get this to work when trying to create feet/inches marks and not bounded quotes:

=choose(Type,"1’-0","2’-0","3’-0","4’-0","5’-0")

Any ideas?

Is this in regards to a Dynamic Component?

Yes, it is.

OK. I just moved it to the right category so the right people will be along to help.

I think you need to use a work around as the code evaluates the strings in a formula, try referencing attributes (a1,a2,…) with their properties set to text (not just the default grayed out value), then choose(Type, a1,a2,a3…)

measures.skp (20.9 KB)

I know that “/” cannot be used as its evaluated as division when passed to a formula, so use decimal rather than fractions

The workaround I came up with was create a variable “Q” and assigned it the quote ("). Then concatenated it to the feet/inches string.

1 Like

I saw this yesterday. I think it is printed incorrectly.

Backslash escaping always precedes the escaped character.

(As is currently)
For example:
="This is the "\official\" retail price for this item:" & variable name

(Should be:)
For example:
="This is the \"official\" retail price for this item:" & variable name

Meaning that the code wants the word official to be delimited with double quotes in the label, etc.

For some reason, that never worked. It doesn’t seem to work if you only want 1 double quote.
If I copy/paste in:

=choose(DR010_Type,“1’-0"”,“2’-0"”,“3’-0"”,“4’-0"”,“5’-0"”)

it changes the (") to just the double quote - it seems to work the first time, but if you hit Enter again, you get an error.

My workaround works consistently, I just don’t understand the “official” word on this.

We cannot see what you paste in … the forum is replacing with smart quotes.
(Use a code block, or delimit your paste in code with backquotes.)

Sorry - not familiar with the code block


=choose(DR010_Type,“1’-0\"”,“2’-0\"”,“3’-0\"”,“4’-0\"”,“5’-0\"”)

From memory, I think it is replaced with the ampersand html name the first parse, leaving it useless the second.

oh … "

Nope, Skippy changes (") into the double quote character and gives an error.

The way I handle that is to use two single quotes to denote inches! (‘’) It looks almost the same as a double quote (“), but does not suffer from the issue of being seen as an actual quote. It’s a kludge, yeah, and not very elegant, but it works. SketchUp DC is so buggy anyway, that sometimes the only solution is to fake things in other ways. Another “trick” I use is the vertical bar “|” instead of a slash for fractions. So instead of ( 3/4” ) I have (3|4’'). It looks a bit weird, yes, but you get used to it, and SketchUp does not try to do division on your fraction.

Example: 1-1/2"

=concatenate(1 ,char(45), 1,char(65295),2,char(34))

char(65295) => “/” not “/”
char(65295) this is a Traditional Chinese character code

not perfect but it works

I guess I never responded to this when I found the best solution. Set a custom Attribute to the Double Quote - in my example the Attribute I used in “Q”. This all you have to do is concatenate the Attribute “Q” to the end of your text String (e.g. “2’-0”+Q). Easy Peasy

1 Like

Ha! That’s brilliant.