Hi!
Sorry for this `stupidquestion 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 `brainlessattempt 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.