Sign in to follow this  
Followers 0
nobby

Replace ' with "'"

4 posts in this topic

I am trying to replace all instances of a single quotation mark in a text file with "'" (single quotation mark between 2 double quotation marks) in order to import the result in a SQL database, which does not like single quotation marks.

Basically it is a name import. All works well until the import process encounters O'Donnell.

Any suggestions would be welcome.


CheersNobby

Share this post


Link to post
Share on other sites



_ReplaceStringInFile could help out... see the help file.


> there are 10 types of people in the world, those who understand binary and those who don't.

Share this post


Link to post
Share on other sites

If you have the latest beta you may be interested in...

Global $myString = "This is someone's string of strings. I need to find Jarvis' favorite cup."
Global $myRE = "'"
Global $myReplace = '"' & "'" & '"'

$tsrstart = TimerInit()
$myStringReplace = StringReplace($myString, $myRE, $myReplace)
$tsrend = TimerDiff($tsrstart)

$tsrestart = TimerInit()
$myStringREReplace = StringRegExpReplace($myString, $myRE, $myReplace, 0)
$tsreend = TimerDiff($tsrestart)

MsgBox(0, "Test...", "String Replace Time:" & @TAB & $tsrend & @CRLF & $myStringReplace & @CRLF & @CRLF & _
                     "String RE Replace Time:" & @TAB & $tsreend & @CRLF & $myStringREReplace)

It was a quick test I did to see the time differences.

On a larger string StringREReplace should be much faster.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

Thanks for your help.


CheersNobby

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0