Escape sequence does not generate the right string

We want to create the classic query :
select * from table where columnName = "xxxx"; with xxxx is dynamic and double quoted.
We use this instruction : queryParts = #"Bank = "#(list[idx])" ;"#
where queryParts ans list[idx] are String
and we get this string : "Bank = "CE" ;"
Why we get these two backslash ?

Could you provide a short snippet that recreates an issue and what you'd expect/want the result to be. You can also put code in triple back ticks:

Like this

Most likely you'd want to post the question on #swift-users instead. This category is about tinkering with the compiler.

Are you sure these are regular Strings? It's possible that a nice Swift SQL library "does the right thing" by implementing string interpolation in a way that properly escapes interpolated values and prevents SQL injection from being possible. (here's an example)

It works !
It is only the display in the debugger that is misleading (and surprising)
Printing is correct
The use is also correct
Thanks for your intervention

Thank you very much
I do not know it
I will take a look.

Terms of Service

Privacy Policy

Cookie Policy