Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
backslash in quotes
Its Me
3/11/2006 5:49:00 AM
Why is \ the same as \\ in the 1st 2 cases, but not in the 3rd?
irb(main):001:0> 'c:\a\b'
=> "c:\\a\\b"
irb(main):002:0> 'c:\a\\b'
=> "c:\\a\\b"
irb(main):004:0> 'c:\a\b\'
irb(main):005:0'
Thanks.
1 Answer
Alan Burch
3/11/2006 6:54:00 AM
0
itsme213 wrote:
> Why is \ the same as \\ in the 1st 2 cases, but not in the 3rd?
>
> irb(main):001:0> 'c:\a\b'
> => "c:\\a\\b"
> irb(main):002:0> 'c:\a\\b'
> => "c:\\a\\b"
> irb(main):004:0> 'c:\a\b\'
> irb(main):005:0'
>
> Thanks.
I'm new here, but I can answer this one. In the last one you are
escaping your single ' mark and so are not terminating the string. Do
you mean 'c:\a\b\\' or do you want 'c:\a\b\'' ? To ruby it looks like
you want to embed a \n in the string and adding another ' and <cr> will
complete it.
Alan
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
backslash in quotes
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password