The condition never became true in my program. Thus I added some debug output. This is the the debugging code:
if not obj.text == localtext
then
print "\"#{obj.text}\" is not equal \"localtext\"\n"
end
This is, what it gave me:
"hello world" is not equal "hello world"
It's not worth trying the example above, since it's not the actual code. The actual code in my project is much more complex, that's why I used this example to discribe my problem.
Fact is that when the string comparison does not succeed I get an output like
"hello world" is not equal "hello "world"
Now it's your turn... What could cause this behaviour?
Just to remove any precedence weirdness, does this behave differently
from your failing code?
puts %Q[#{obj.text} differs from #{localtext}] unless obj.text == localtext
···
On 12/14/05, Boris Glawe <boris@boris-glawe.de> wrote:
if not obj.text == localtext
then
print "\"#{obj.text}\" is not equal \"localtext\"\n"
end
The condition never became true in my program. Thus I added some debug output. This is the the debugging code:
if not obj.text == localtext
then
print "\"#{obj.text}\" is not equal \"localtext\"\n"
end
This is, what it gave me:
"hello world" is not equal "hello world"
It's not worth trying the example above, since it's not the actual code. The actual code in my project is much more complex, that's why I used this example to discribe my problem.
Fact is that when the string comparison does not succeed I get an output like
"hello world" is not equal "hello "world"
Now it's your turn... What could cause this behaviour?
Isolate the problem, and wrap it in a test/unit. Then I can take a closer look.
The problem was a whitespace, which I did not see. I actually wrapped the output in apostrophs in order to see whitespaces. Since I am programming with cgi, I see the output in the browser window, which prints whitespaces very small.