Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Sanity check on File.dirname
Daniel Berger
2/10/2009 8:05:00 PM
Hi,
I need a quick sanity check.
Excepting potential backslashes for the moment, aren't these two
identical?
File.dirname(path).split('/')[0..-2].join('/')
File.dirname(File.dirname(path))
Dan
1 Answer
Pit Capitain
2/11/2009 9:22:00 AM
0
Dan, they differ if the path isn't nested deeply enough, for example
"/a/b", "/c" or "d".
Regards,
Pit
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Sanity check on File.dirname
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