Sunday, November 9, 2008

Caution with String concat <<

If you have a string a = "test" and you want to append dynamic data, be careful with <If the dynamic data happens to be a Fixnum between 0 and 255, it is converted to a character before concatenation.

>> a = "test"
=> "test"
>> a << 12
=> "test\f"
>>

No comments: