hi,
im getting tired on this one.
i want to replace all forwardslashes with backwardslashes.
irb:
r = “C:/RAILS/”
r.gsub("/", “\”) or r.gsub("/") {(’’} both give me:
“C:\RAILS\”
how can i use gsub to display only one “”?
regards
hi,
im getting tired on this one.
i want to replace all forwardslashes with backwardslashes.
irb:
r = “C:/RAILS/”
r.gsub("/", “\”) or r.gsub("/") {(’’} both give me:
“C:\RAILS\”
how can i use gsub to display only one “”?
regards
On 23 March 2012 10:36, Aaron S. [email protected]
wrote:
how can i use gsub to display only one ""?
It’s escaping it to show in the console, the string does have only one
backslash.
=> “\”.size
1
thank you…never thought about that…
next question!
when i put in mit shell : i_view32.exe C:\Rails\test.png
/convert=C:\Rails\test.jpg it works. but when i do
system(“i_view32.exe C:\Rails\test.png /convert=C:\Rails\test.jpg”)
it doesn’t work.
what am i doing wrong?i guess it is escaping instead of taking it as a
string. do i have to add three more “” ?
On 23 March 2012 12:49, Aaron S. [email protected]
wrote:
next question!
system(“i_view32.exe C:\Rails\test.png /convert=C:\Rails\test.jpg”)
doesn’t work.
What happens when you try:
system(“i_view32.exe C:\Rails\test.png
/convert=C:\Rails\test.jpg”)
?
“=> nil”
i can start “calc.exe” from firefox via the controller that says “*
system(“calc.exe”)*”.
but i cannot start i_view32.exe or firefox.exe etc.
is it a permission issue on win xp?
the command is ok, i tested it in cmd.exe
On 23 March 2012 13:46, Aaron S. [email protected]
wrote:
is it a permission issue on win xp?
the command is ok, i tested it in cmd.exe
Probably… I recommend a nice Linux install (even just a VM…
Does system(‘i_view32.exe’, ‘C:\Rails\test.png’,
‘/convert=C:\Rails\test.jpg’) work for you?
On Fri, Mar 23, 2012 at 8:49 PM, Aaron S.
yep. i didnt escape the string twice…so i just got confused with the
irb-way to show the string.
so i used gsub("/", “\\”) and it worked.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs