473,883 Members | 2,864 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Replace double quotes inside of a string

Seth Schrock
2,965 Recognized Expert Specialist
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
4 25955
12,516 Recognized Expert Moderator MVP
Expand|Select|Wrap|Line Numbers
  1. Replace(string, """", """""")
Jun 27 '13 #2
Seth Schrock
2,965 Recognized Expert Specialist
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
12,516 Recognized Expert Moderator MVP
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 Recognized Expert Specialist
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

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? thanks
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 ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
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 quotes for table name and field name, something like this: select * from public."Customers" Therefore, when I put it as string in VBA it looks like: "select * from public."Customers"" and VBA thinks that " after public. is the end of statement.
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, when I write it as a string of a pass-through query or Command Text of ADO Command object it looks like: "select * from public."Customers"" anbd VBA thinks that the first quote after public. is the end of statement. How to solve it ?
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 in single quotes to deal with embedded double quotes, but if there are both embedded single AND double quotes, I can't see any way to deal with it. So, am I doing the right thing to remove all embedded double quotes from my data and write...
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 comes in when you copy a double quote from MS Word and paste it in the text box. What happens is the double quote becomes slanted (“) so my code above can't filter it. I tried to do this text= Replace(text, "““","'")
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 myfile("test1.txt"); text file is like this "1 91 2" 49 1 "1 91 20" 49 1
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 irritant and where to I locate the fix. I have done some research about quote blocker script and the use of /" /". But where to exactly place the fix I am unsure.. Thanks, Louis
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, it must be done like this: insert into table values (nextval('"MySeq"')
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 am having a problem loading the XML correctly into my app. Here is the code: ==================================== Dim sPaymentXML as String
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.