How to resolve a string in a variable?

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

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"