From: Roland Klein overmeer Date: 2011-01-24T18:17:32+09:00 Subject: String replace ' for mySQL insert 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[i]="'" result=result + "''" else result=result + line[i] end end line=result end What am I doing wrong? Thanks, Roland -- Posted via http://www.ruby-forum.com/.