4463
Views
14
Comments
Solved
How to add double quotes in a string ?
Question

Need to know how can I add a string "Ashish" to a variable name that it's value would be :


Name (datatype text) = "Ashish" (value)


as Name = ""Ashish"" would not work for obvious reasons.


Thanks 



2021-03-05 13-56-11
Ricardo Pereira
 
MVP
Solution

Hi,


If you want to do something with a variable that don't have quotes and want to add to it, you can do like this to:


The principle is the same that Nordin and Maycon told here, but with variables.


Regards,

Ricardo

2021-08-12 11-00-27
Nordin Ahdi
 
MVP

Hi Ashish,

Try Name = """Ashish""" (So three double quotes)

Kind regards,

Nordin

2026-01-19 11-49-41
Maycon Silva

Hi Ashish,


When you put two double quotes the expression validator will understand you are trying concatenate a blank space plus Ashish variable plus a blank space, but it's not validate because there are no the plus (+) between then.


If you put three quote, like Nordin said, expression will be validate.



I hope helped you.



Best regards


Maycon Silva

2021-03-05 13-56-11
Ricardo Pereira
 
MVP
Solution

Hi,


If you want to do something with a variable that don't have quotes and want to add to it, you can do like this to:


The principle is the same that Nordin and Maycon told here, but with variables.


Regards,

Ricardo

2021-10-19 19-16-35
Ashish-S

Hey All

Thanks for your inputs I do realize that the two double quotes in the start give it a empty string that is up for a concatenation, I actually am trying to run an API in which, in the onBeforeRequest action need to append the JSON for payload to the CustomisedRequest.Text and since the JSON always has double quotes I am not sure how to pass them. I would love to give more inputs if needed.


Thanks for all your answers!!

Cheers

2018-12-28 12-12-31
Barrie Roche

Ashish Sarwal wrote:

Hey All

Thanks for your inputs I do realize that the two double quotes in the start give it a empty string that is up for a concatenation, I actually am trying to run an API in which, in the onBeforeRequest action need to append the JSON for payload to the CustomisedRequest.Text and since the JSON always has double quotes I am not sure how to pass them. I would love to give more inputs if needed.


Thanks for all your answers!!

Cheers


Hi Ashish did you get a resolution.  If so please can you share.

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Hi Ashish,

If you search the forum you will notice this question asked multiple times and with answers nsrked as solution.

With literal strings you put two double quotes for every single one.

Regards,

Daniel

2020-12-15 16-38-46
Michael Adams

No, this doesn't actually work

It returns this 

And I want this ""999999999"",

How do you do that^^^^???

2017-03-03 12-48-17
Balasubramanian Prakasam

Hi Michael,

Design:

Runtime:

Result Output textbox:


are you expecting this?


Thanks,

Balu

2020-12-15 16-38-46
Michael Adams

No, the output string in the debugger has to look like this ""999999999"". This is for a Restful api json request that requires the variable to be enclosed in double quotes. The text variable has to be stored with single quotes like this: "999999999", then when it is sent it will be received like this ""999999999"". That's what we can't get it to do.

2021-10-19 19-16-35
Ashish-S

To simplify

" ' "  gives single quote( ' ) in string

" "" " gives double quote( " ) in the string

Now you should try the combination you need. Posting late, just for new people who may land on this post.

2023-07-03 14-28-45
Vinicius Seixas

Hello all! I followed this, but using """" is giving me 2 double quotes instead of one. 

Any ideas?

2024-09-27 08-47-09
Rashmi Hatwar

Hi Vinicius,


For 1 double quote you can follow below format :
If you want to show text as "Vinicius" then write

""""+"Vinicius"+""""

And if you want to show text from any variable then write,

""""+Test+""""

where Test variable will have text value.

Hope this will resolve your query.

Regards,

Rashmi

UserImage.jpg
António Matos

You can use CHR(34), for example

for the text: "expression" you can do this CHR(34)+ "expression"+ CHR(34) and the result will be

"expression".

Let me know if worked for you

2023-04-14 11-47-10
Samuel Frade

I passed the same few days ago and the debugger was my best friend :) 

To add a single quote or a double quote for HTML attributes) within a string in OutSystems, you need to "escape" it.

Here's how it works:

  • OutSystems uses quotation marks (") to define the start and end of a text string.
  • If you want to include a quotation mark inside the string, you can't just type it directly because OutSystems will think it's the end of the string.
  • To fix this, you use """" (four quotation marks in a row). This tells OutSystems to treat the inner two quotation marks as a single literal quotation mark.

Example from my code:

"<p style= " +""""+ " display: flex;justify-content: center;" +""""+ ">" 

  • "<p style= " starts the HTML style attribute.
  • +""""+ adds a quotation mark (").
  • " display: flex;justify-content: center;" is the style value.
  • +""""+ adds another quotation mark (").
  • "> closes the style attribute.

In short, use """" whenever you need to insert a quotation mark within a string in OutSystems. 

Debugging:
This was what I have in the Assign:"

    "<p style= " +""""+ " display: flex;justify-content: center;" +""""+ "> 
   <img style= " +""""+
     display:" +""""+ "block;width:200px;height:200px;display:inline-block;" +""""+
     " id=" +""""+ "base64image" +""""+
     " src=" +""""+ "data:image/png;base64, " + EncodeHtml(BinaryToBase64.Base64) + " " +""""+ "> </p>" 

This is after the Assign:

<p style= " display: flex;justify-content: center;">
  <img style= "
      display:"block;width:200px;height:200px;display:inline-block;"
      id="base64image"
      src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUg...">
</p> 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.