From: Alan Moore Date: 2001-10-15T17:09:47+09:00 Subject: [ruby-talk:22557] String#succ w/non-alphanumeric strings Hi all, I've run into some odd behavior when I call the succ method on a string with no alphanumeric characters. First, a demonstration: "***".succ >> "**+" "*".succ >> "\001+" sprintf("%c", 255).succ >> "\001\000" sprintf("*%c", 255).succ >> "\001+\000" sprintf("**%c", 255).succ >> "*+\000" The first line is an example out of the pickaxe book. What the rest are showing is that, if the first character gets incremented, whether it forces a carry or not, a '\001' character is prepended to the string. I suspect that the '\001' is meant to be the successor to '\377' (or 255), and the last three lines are supposed to look like this: sprintf("%c", 255).succ >> "\001\001" sprintf("*%c", 255).succ >> "+\001" sprintf("**%c", 255).succ >> "*+\001" Can anyone confirm this? Or tell me how it's supposed to work? --Alan