Hello, my problem is the following:
A Store send me a *.txt file with content to add to Data base.
Format of the file: line1) =>
"COL1";"COL2";"COLn"
line2 and more)=>
"data1";"data2";"dataN"
Ok, I want format these lines for insert it into a query, everythings well, no
problem, but...
but in the second line and following I have to change the " character for '
character,
the normal actuation would be this: replace(line,"#chr(34)#","#chr(39)#","all")
but this have a strange behavior: change the " char for two ' chars.
If you try to change the " char for something other char the result is ok, but
with the ' char there isn't way :(.
Please, if this issue is solved in other place give me the link, else give me
the answer :) or give me
comments about.
Greets.
BKBK - 28 Dec 2005 14:44 GMT
The function XMLFormat() will escape the single-quotation mark (') with '
and the double-quotation mark (") with ' . Therefore, doing something like
this will avoid any confusion:
<cfset line = Replace(XMLFormat(line), "'", "'", "all")>
Sam_G2 - 29 Dec 2005 14:08 GMT
Thanks BKBK, in my own case that solution don't work, but I have considered
more options and finally I found the solution:
-The problem was that I assign the value returned by 'replace' function into a
variable and I don?t know why when I display the value of that variable show
two apos instead of only one.
-I have used the result of the function directly where I wan instead of into a
variable, of this way work, but you have to do that 'replace' the last.
It isn't the best way, but work. I continue with the doub, but the moment I
don't go to worry more.
Thank other time.