473,320 Members | 1,988 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,320 software developers and data experts.

Replace Function

JT
how can i replace all single quotes in a string to double quotes:

Replace(strLog_text, "'", """)

however, this doesn't work, as you might expect.

any ideas??
Jul 19 '05 #1
6 2204
YourString = Replace(YourString, "'", """")
'or
theNewString = Replace(YourString, "'", """")

To "escape" a " character in a string, you put it twice, "".

Mind if I ask why you're replacing ' with " though?

Ray at work

"JT" <je******@sppinc.net> wrote in message
news:ex**************@TK2MSFTNGP09.phx.gbl...
how can i replace all single quotes in a string to double quotes:

Replace(strLog_text, "'", """)

however, this doesn't work, as you might expect.

any ideas??

Jul 19 '05 #2
Replace(Data, Chr(34), Chr(34) & Chr(34))

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
JT <je******@sppinc.net> wrote in message
news:ex**************@TK2MSFTNGP09.phx.gbl...
how can i replace all single quotes in a string to double quotes:

Replace(strLog_text, "'", """)

however, this doesn't work, as you might expect.

any ideas??

Jul 19 '05 #3
Woops.. sorry, just realised you meant ' and not ", lol

Replace(data, Chr(39), Chr(34) & Chr(34))

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
Steven Burn <nobody@PVT_it-mate.co.uk> wrote in message
news:OR*************@TK2MSFTNGP12.phx.gbl...
Replace(Data, Chr(34), Chr(34) & Chr(34))

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
JT <je******@sppinc.net> wrote in message
news:ex**************@TK2MSFTNGP09.phx.gbl...
how can i replace all single quotes in a string to double quotes:

Replace(strLog_text, "'", """)

however, this doesn't work, as you might expect.

any ideas??


Jul 19 '05 #4
> how can i replace all single quotes in a string to double quotes:

Why would you want to do that? Does O'Brien want to change his name to
O"Brien?

strLog_text = Replace(strLog_text, "'", CHR(34))
or
strLog_text = Replace(strLog_text, "'", """")

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
Jul 19 '05 #5
I've done it again........ there's only meant to be one Chr(34)...... not
two :o\

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
Steven Burn <nobody@PVT_it-mate.co.uk> wrote in message
news:#q**************@TK2MSFTNGP11.phx.gbl...
Woops.. sorry, just realised you meant ' and not ", lol

Replace(data, Chr(39), Chr(34) & Chr(34))

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
Steven Burn <nobody@PVT_it-mate.co.uk> wrote in message
news:OR*************@TK2MSFTNGP12.phx.gbl...
Replace(Data, Chr(34), Chr(34) & Chr(34))

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
JT <je******@sppinc.net> wrote in message
news:ex**************@TK2MSFTNGP09.phx.gbl...
how can i replace all single quotes in a string to double quotes:

Replace(strLog_text, "'", """)

however, this doesn't work, as you might expect.

any ideas??



Jul 19 '05 #6
jon
Replace(strLog_text, "'", """")

************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
Jul 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Barnes | last post by:
Does anyone know of a good way to use the JavaScript string.replace() method in an ASP form? Here is the scenario: I have a form that cannot accept apostrophes. I want to use the replace() so...
6
by: Danny | last post by:
I need an asp command to strip out from a string all extra punctuation such as apostrophe, comma, period, spaces dashes, etc etc and just leave the letters. Can anybody give me some ideas? ...
4
by: higabe | last post by:
Three questions 1) I have a string function that works perfectly but according to W3C.org web site is syntactically flawed because it contains the characters </ in sequence. So how am I...
12
by: Brian | last post by:
I want to use regxp to check that a form input contains at least 1 non-space charcter. I'd like to only run this if the browser supports it. For DOM stuff, I'd use if (documentGetElementById) {}...
3
by: Dave | last post by:
I have an Access 2K application that is distributed to about a dozen users (all with identical NT environments and identical Access versions, object libraries and service packs). I am using the VBA...
5
by: pembed2003 | last post by:
Hi all, I need to write a function to search and replace part of a char* passed in to the function. I came up with the following: char* search_and_replace(char* source,char search,char*...
19
by: Paul | last post by:
hi, there, for example, char *mystr="##this is##a examp#le"; I want to replace all the "##" in mystr with "****". How can I do this? I checked all the string functions in C, but did not...
5
by: djc | last post by:
I need to prepare a large text database field to display in an asp.net repeater control. Currently I am replacing all chr(13)'s with a "<br/>" and it works fine. However, now I also want to be able...
4
by: Lauren Wilson | last post by:
Hi folks, We have a need to replace sub strings in certain message text. We use the Office Assistant to display help and often use the imbedded formatting commands. Those of you who have used...
10
by: pamelafluente | last post by:
I need to replace all the occurences of a string within another string (or stringbuilder): Function ReplaceInsensitive(ByVal InputString As String, _ ByVal SubstringReplaced As String, _ ByVal...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.