Jump to content

Replace ' with "'"


nobby
 Share

Recommended Posts

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

Link to comment
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)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...