On Sep 8, 2008, at 9:15 AM, Rafael Viana wrote:

> Is it possible to have a string with a single backslash?
>
> I want var to have the value "\foo"
>
> And when I do something like:
>
> var = "\foo"
> I get
> "foo"
>
> But when I do:
>
> var = "\\foo"
> I get
> "\\foo"
>
> And when I do:
>
> var = '\foo'
> I get
> "\\foo"
>
> I even tried to remove one of the backslashes from the "\\foo" string,
> but then I just get "foo" :-(
>
>
> Thanks for reading, and I hope you can help me out

I just have to point out (since I don't think anyone else did) that  
"\f" is a single character string:  \f is an escape code for a form- 
feed (ASCII 0x0C)

You're confusing the literal syntax for a backslash followed by a  
letter with the actual contents of the string:  "\\f".size == 2

-Rob

Rob Biedenharn		http://agileconsultingllc.com
Rob / AgileConsultingLLC.com