From: Kevin Smith Date: 2000-12-14T16:54:58+09:00 Subject: [ruby-talk:7203] Re: Put slash as last character in string? >"Chris Morris" writes: > >> How can I have a string with a single backslash as the last character? >> >> "c:\temp\\" => "c:\temp\\" > >Just like that. If you're using irb to check it out, then you'll get >slightly misleading output, as irb by default uses #inspect to display >strings, and #inspect escapes special characters. Thus even though the >string has just one '\', it is output by irb with two. Correct me if I'm wrong, but I believe that should be: "c:\\temp\\", unless you really want a tab after the colon. And, correct me if I'm wrong, but I believe that you could instead use: 'c:\temp\', since ' ' strings don't expand escape sequences. Finally, in almost all cases, Windows is fine with forward slashes. In code, I almost never use \ any more. Kevin