Hi All,
           I have a string (which contains variable) in a variable
variable_name = "sample variable"
initial_string = "#{variable_name} and the text goes on" (The string
is being retrieved from Database (as string), so automatic variable
resolving will not happen)
I need to have
 some_function(initial_string) -----> "sample variable and the text
goes on"
I hope i am clear!
Regards,
Mohit
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
mohit_ranka wrote:> Hi All, > I have a string (which contains variable) in a variable > > variable_name = "sample variable" > > initial_string = "#{variable_name} and the text goes on" (The string > is being retrieved from Database (as string), so automatic variable > resolving will not happen) > > > I need to have > > some_function(initial_string) -----> "sample variable and the text > goes on" > > I hope i am clear! > > Regards, > Mohit>> variable_name = "sample variable"=> "sample variable">> eval("variable_name")=> "sample variable">> eval "variable_name + '' and the text goes on''"=> "sample variable and the text goes on" -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---