Discussion

Left ArrowBack to discussions page
warrenj123warrenj123 Posts: 3 Apprentice
How do you include quotes in a URSCRIPT?

I.e what is the escape character for “

Comments

  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,015 Handy
    Do you need double quotes?  You could always use single quotes inside the string, if not, try \”   I’m not sure UR supports escape characters. 
  • warrenj123warrenj123 Posts: 3 Apprentice
    Thanks Matthew. 
    I’ve tried \” and ^” as I’ve seen them in other languages but had no joy. 

    The full story is I’m using socket messaging to talk to a device returning JSON format data. I’m mostly interested in reading data that is including a “. 

    My current approach is to use the socket_read_byte_list function and check the character in ascii format. This is a bit long winded and was hoping to find a neater solution. 
    I am however on a cb2.1 controller which uses a cut down scripting library which limits my options further. 
  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,015 Handy
    Sonyou are trying to read JSON stringifed data on the robot or want to send it to the server?  When we send JSON formatted data to the server we swap the quotes, “ around the string and ‘ around the keys. We then swap it on the server to format it correctly 
  • warrenj123warrenj123 Posts: 3 Apprentice
    So you have access to the server code/ software? Or are you using something in between?

    I don't have that option unfortunately.

    My hope was that there was a way to represent " but not looking promising at the moment.
  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,015 Handy
    Yes, the server is our own software so we are able to do whatever we need to make things work....
Sign In or Register to comment.
Left ArrowBack to discussions page