R
Roland Klein overmeer
Hello All,
I'm a newbie, just started programming Ruby about 1 month ago. Have lots
of experience with vb so the programming concepts are clear to me. I'm
building a script that is using the sample stream of the Twitter API and
insert it into MySQL for analysis. The problem is, that some of the
tweets have a ' in them. I want to replace them with '' so insert into
SQL is not a problem. I have written some piece of code trying to get
this to work, but the output replaces every letter with ''. This is the
code:
if line.include?"'"
result=""
teller=line.length-1
for i in 1..teller do
if line="'"
result=result + "''"
else
result=result + line
end
end
line=result
end
What am I doing wrong?
Thanks,
Roland
I'm a newbie, just started programming Ruby about 1 month ago. Have lots
of experience with vb so the programming concepts are clear to me. I'm
building a script that is using the sample stream of the Twitter API and
insert it into MySQL for analysis. The problem is, that some of the
tweets have a ' in them. I want to replace them with '' so insert into
SQL is not a problem. I have written some piece of code trying to get
this to work, but the output replaces every letter with ''. This is the
code:
if line.include?"'"
result=""
teller=line.length-1
for i in 1..teller do
if line="'"
result=result + "''"
else
result=result + line
end
end
line=result
end
What am I doing wrong?
Thanks,
Roland