From: Alexandru Popescu Date: 2006-01-18T23:47:05+09:00 Subject: how to double single quote (beginner blockage) Hi! Sorry for this `stupid� question but it looks like i am suffering a mental blockage: if I have a string that contains single quote (f.e. "al'alamein") i would like to escape it with another single quote (=> "al''alamein"). there are cases when these strings are already escaped according to the above rule, so those should remain untouched my `brainless� attempt was: [code] fixed_value = "" wrong_value.each_with_index do |char, idx| fixed_value << char if ( (idx < wrong_value.size - 1) && (wrong_value[idx + 1] != '\'') && (idx > 0) && (wrong_value[idx - 1] != '\'')) fixed_value << '\'' end end [/code] but the above results in exactly the same strings. I would appreciate very much your help ./alex -- .w( the_mindstorm )p.