RichardOnRails
2/21/2009 7:47:00 PM
On Feb 19, 10:00 pm, botp <botp...@gmail.com> wrote:
> From: 7stud -- [mailto:bbxx789_0...@yahoo.com]
> # backslash. lol.
> # 3 backslashes in final result
>
> you can do,
>
> line.sub!(/(HREF=)/){|x| x+'file:\\\\\\'}
>
> well, if you work on strings and on OSes that use backslashes as
> file/dir separators, it will be fun-ny :)
>
> kind regards -botp
> (replying in gmail; apologies in advance if this gets duplicated, my
> outlook program is acting weird :)
Hi botp,
Thanks for your response. It somehow gets around the problem with my
approach, which seems to perform string-substitution twice, as I
mentioned to the previous respondent.
Just for the record, I had to sub the string HREF=" to get the result
I was after.
> well, if you work on strings and on OSes that use backslashes as
> file/dir separators, it will be fun-ny :)
I am working on WinXP, which as you no doubt know uses backslashes for
separators. Thanks to the previous respondent's use of puts in place
of p, the debugging output looks much neater. And sticking file:\\in front of a name of a file-system object gets Windows to handle the
local file through the browser. The only problem for my purposes is
(apparently) that the browser won't invoke the local file; it only
permits saving a copy of it somewhere else in the file-system.
Again, thanks for your very neat expression.
Best wishes,
Richard