473,396 Members | 1,843 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Replace double quotes inside of a string

Seth Schrock
2,965 Expert 2GB
In one of my databases, I have a name field where I recently came across a problem. Someone had entered the person's nickname inside double quotes. This works until I come to the part where I create a report and try to save it as a PDF with the name field as part of the file name. For example, the name could be James "Jim" Doe. My first idea was to use the Replace function, but it didn't like searching for """. Is there another way to do this?
Jun 27 '13 #1

✓ answered by Rabbit

Expand|Select|Wrap|Line Numbers
  1. Replace(string, """", """""")

4 25857
Rabbit
12,516 Expert Mod 8TB
Expand|Select|Wrap|Line Numbers
  1. Replace(string, """", """""")
Jun 27 '13 #2
Seth Schrock
2,965 Expert 2GB
Thanks Rabbit. It worked perfectly. I thought originally that it would be searching for two double quotes together, but it worked.
Jun 28 '13 #3
Rabbit
12,516 Expert Mod 8TB
When you put two double quotes with in a string, that's an escape sequence. It's saying, I'm not trying to end this string I'm building, but rather I want to insert one double quote character into the string I'm building.

It sees the first double quote and says, okay, time to build a string.

Then it sees the second double quote and says, okay, time to end the string. At this point, you have a 0 length string.

Then it sees the third double quote and says, oh, nevermind, the last double quote wasn't supposed to end the string, they actually want one double quote.

Finally it sees the last double quote and says ok, now it's time to end the string.
Jun 28 '13 #4
Seth Schrock
2,965 Expert 2GB
Ah. That is nice to know.
Jun 28 '13 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: P1ayboy | last post by:
I have a string that contains double quotes. I need to replace these, but how can i do it as the code would be: replace(string,""","") Is there a way of breaking out of the double quotes? ...
3
by: Christopher Benson-Manica | last post by:
Why doesn't this replace all double quotes in a string with the letter Q? source.replace( /"(*)"/g, "Q$1Q" ); -- Christopher Benson-Manica | I *should* know what I'm talking about - if I...
2
by: Zlatko Matić | last post by:
Hello. I have a problem when writing strings for pass-through queries or command text for ADO command object while working with PostgreSQL as back-end. Namely, SQL dialect syntax uses double...
1
by: Zlatko Matić | last post by:
I have a problem when working with PostrgeSQL as back-end. Namely, PostgreSQL syntax uses doble quotes for table names and field names. For example: select = from public."Customers" Therefore,...
4
by: (PeteCresswell) | last post by:
Is his just a flat-out "No-No" or is there some workaround when it comes time for SQL searches and DAO.FindFirsts against fields containing same? I can see maybe wrapping the value searched for...
7
by: gar | last post by:
Hi, I need to replace all the double quotes (") in a textbox with single quotes ('). I used this code text= Replace(text, """", "'" This works fine (for normal double quotes).The problem...
0
by: bturan | last post by:
Hey I'm trying to read a double quoted string from a file and then tring to write it to the file within double quotes how do I do it" ifstream myfile("test.txt"); ofstream...
8
by: MrIT | last post by:
Dear Forum, First, thanks for reading my Post. So basically I have a Java Script program. To add more to the Data base I can not use " Double Quotes inside the string. How do I work around this...
1
by: serid | last post by:
Hi everyone ! I'm new to PostgreSQL and I'm just reading about sequences. If a sequence is created with upper and lower letters, e.g. create sequence "MySeq" then when one want to use it,...
6
by: =?Utf-8?B?R2Vvcmdl?= | last post by:
Hello, I have some XML that is returned to my application from another vendor that I cannot change before it gets to me. I can only alter it after it gets to my application. That being said, I...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.