# String interpolation at will?

**URL:** <https://rubytalk.org/t/string-interpolation-at-will/1894>\
**Category:** ruby-talk\
**Created:** [20 September 2002 19:54 UTC](https://rubytalk.org/t/string-interpolation-at-will/1894 "2002-09-20T19:54:06Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![HAL\_9000](https://avatars.discourse-cdn.com/v4/letter/h/90ced4/32.png) [@HAL\_9000](https://rubytalk.org/u/HAL_9000)\
**Post date:** [20 September 2002 19:54 UTC](https://rubytalk.org/t/string-interpolation-at-will/1894/1 "2002-09-20T19:54:06Z")

</div>

Maybe I’m overlooking something obvious,  
or maybe it’s not possible.

We all know how convenient string interpolation  
can be: msg = “myval = #{myval}”

Is there a way to perform interpolation on  
an arbitrary string? For example, if the  
above string were read in from a file?

gsub doesn’t count. 🙂 Unless you have a  
particularly elegant way to use it.

Cheers,  
Hal

---

<div class="post-metadata">

**Author:** ![Steve\_Tuckner2](https://avatars.discourse-cdn.com/v4/letter/s/ed655f/32.png) [@Steve\_Tuckner2](https://rubytalk.org/u/Steve_Tuckner2)\
**Post date:** [20 September 2002 20:08 UTC](https://rubytalk.org/t/string-interpolation-at-will/1894/2 "2002-09-20T20:08:39Z")

</div>

Maybe this is too dangerous but

File.readlines(“test.txt”).each {|line| print eval(’"’ + line + ‘"’)}

will work. Even if there were a function such as String.interpolate(str) it  
would still be dangerous because any code within the #{} blocks would be  
evaluated!

Steve

> **···**
>
> -----Original Message-----  
> From: Hal E. Fulton [[mailto:hal9000@hypermetrics.com](mailto:hal9000@hypermetrics.com)]  
> Sent: Friday, September 20, 2002 2:54 PM  
> To: ruby-talk ML  
> Subject: String interpolation at will?
> 
> Maybe I’m overlooking something obvious,  
> or maybe it’s not possible.
> 
> We all know how convenient string interpolation  
> can be: msg = “myval = #{myval}”
> 
> Is there a way to perform interpolation on  
> an arbitrary string? For example, if the  
> above string were read in from a file?
> 
> gsub doesn’t count. 🙂 Unless you have a  
> particularly elegant way to use it.
> 
> Cheers,  
> Hal

---

<div class="post-metadata">

**Author:** ![Lyle\_Johnson6](https://avatars.discourse-cdn.com/v4/letter/l/bb73d2/32.png) [@Lyle\_Johnson6](https://rubytalk.org/u/Lyle_Johnson6)\
**Post date:** [23 September 2002 12:15 UTC](https://rubytalk.org/t/string-interpolation-at-will/1894/3 "2002-09-23T12:15:37Z")

</div>

Hal E. Fulton wrote:

> Maybe I’m overlooking something obvious,  
> or maybe it’s not possible.
> 
> We all know how convenient string interpolation  
> can be: msg = “myval = #{myval}”
> 
> Is there a way to perform interpolation on  
> an arbitrary string? For example, if the  
> above string were read in from a file?

Unless I’m completely misunderstanding your point, what about using  
eval()? For example, given the Ruby script:

```
 a = 2
 b = 3

 IO.foreach("commands.txt") do |cmd|
   eval(cmd)
 end

 puts $astr
 puts $bstr

```

and the text file (commands.txt):

```
 $astr = "The value of a = #{a}"
 $bstr = "The value of b = #{b}"

```

I get the result:

```
 The value of a = 2
 The value of b = 3

```

Hope this helps,

Lyle

---

<div class="post-metadata">

**Author:** ![HAL\_9000](https://avatars.discourse-cdn.com/v4/letter/h/90ced4/32.png) [@HAL\_9000](https://rubytalk.org/u/HAL_9000)\
**Post date:** [20 September 2002 20:30 UTC](https://rubytalk.org/t/string-interpolation-at-will/1894/4 "2002-09-20T20:30:50Z")

</div>

> File.readlines(“test.txt”).each {|line| print eval(‘"’ + line + ‘"’)}

Well, I guess you’d have to use gsub to escape any existing quotes  
first…

> will work. Even if there were a function such as String.interpolate(str)  
> it  
> would still be dangerous because any code within the #{} blocks would be  
> evaluated!

Hmm, there have been times I wished for a String.interpolate  
method… couldn’t be too hard to expose it. Wonder if it’s  
worth it?

Danger is always an issue… guess it’s not so bad as long as  
you have control over the data.

Even regular interpolation is potentially dangerous:

string = “Hi, my name is #{format\_hard\_drive\_and\_return\_name()}.”

🙂

Hal

> **···**
>
> ----- Original Message -----  
> From: “Steve Tuckner” [STUCKNER@MULTITECH.COM](mailto:STUCKNER@MULTITECH.COM)  
> To: “ruby-talk ML” [ruby-talk@ruby-lang.org](mailto:ruby-talk@ruby-lang.org)  
> Sent: Friday, September 20, 2002 3:08 PM  
> Subject: RE: String interpolation at will?

---

<div class="post-metadata">

**Author:** ![M\_Mohr](https://avatars.discourse-cdn.com/v4/letter/m/d2c977/32.png) [@M\_Mohr](https://rubytalk.org/u/M_Mohr)\
**Post date:** [23 September 2002 12:15 UTC](https://rubytalk.org/t/string-interpolation-at-will/1894/5 "2002-09-23T12:15:47Z")

</div>

Steve Tuckner [STUCKNER@MULTITECH.COM](mailto:STUCKNER@MULTITECH.COM) writes:

> Maybe this is too dangerous but
> 
> File.readlines(“test.txt”).each {|line| print eval(‘"’ + line + ‘"’)}
> 
> will work. Even if there were a function such as String.interpolate(str) it  
> would still be dangerous because any code within the #{} blocks would be  
> evaluated!

indeed.

im stuck with this version:

# —

def interpolate(str)  
reg = Regexp.new(‘#{(($|@|@@)\w+)}’)  
ret = ‘’  
while (match = reg.match(str))

```
ret += match.pre_match
for i in 1..(match.length-1)
  ret += yield(match[1])
end

str = match.post_match

```

end  
ret += str  
end

# testing calls:

a = ‘3012’  
b = ‘1322’  
str = ‘foo “#{a} #{b}”’

p interpolate(str) {|match| eval(match)}  
p interpolate(‘#{a}’) {|match| eval(match)}

# —

and i have 2 questions to the community:

1. i was not able to find an equivalent to perl’s regexp-substitutes, so i had to do the  
ugly/complex/inefficient loop-contruct in “interpolate”. is there a better way to achieve  
this in ruby?

2. i have to call interpolate with the eval block appended, so that the variables a  
looked up in the scope of the calling environment. is there a more better way to do  
this, or to make ‘{|match| eval(match)}’ the default, if no block is supplied?

regards  
messju

> **···**
>
> > Steve
> > 
> > -----Original Message-----  
> > From: Hal E. Fulton [[mailto:hal9000@hypermetrics.com](mailto:hal9000@hypermetrics.com)]  
> > Sent: Friday, September 20, 2002 2:54 PM  
> > To: ruby-talk ML  
> > Subject: String interpolation at will?
> > 
> > Maybe I’m overlooking something obvious,  
> > or maybe it’s not possible.
> > 
> > We all know how convenient string interpolation  
> > can be: msg = “myval = #{myval}”
> > 
> > Is there a way to perform interpolation on  
> > an arbitrary string? For example, if the  
> > above string were read in from a file?
> > 
> > gsub doesn’t count. 🙂 Unless you have a  
> > particularly elegant way to use it.
> > 
> > Cheers,  
> > Hal

---

<div class="post-metadata">

**Author:** ![David\_Alan\_Black1](https://avatars.discourse-cdn.com/v4/letter/d/278dde/32.png) [@David\_Alan\_Black1](https://rubytalk.org/u/David_Alan_Black1)\
**Post date:** [20 September 2002 20:43 UTC](https://rubytalk.org/t/string-interpolation-at-will/1894/6 "2002-09-20T20:43:42Z")

</div>

Hi –

> Even regular interpolation is potentially dangerous:
> 
> string = “Hi, my name is #{format\_hard\_drive\_and\_return\_name()}.”

Although if it’s variable interpolation/expansion, you’ll just get the  
string:

irb(main):001:0\> s = gets.chomp!;puts “#{s}”  
puts ‘blah’ # input  
puts ‘blah’ # output

(i.e., it doesn’t actually puts ‘blah’)

And if it’s a string constant, it’s dangerous anywhere 🙂

David

> **···**
>
> On Sat, 21 Sep 2002, Hal E. Fulton wrote:
> 
> –  
> David Alan Black | Register for RubyConf 2002!  
> home: [dblack@candle.superlink.net](mailto:dblack@candle.superlink.net) | November 1-3  
> work: blackdav@shu.edu | Seattle, WA, USA  
> Web: [http://pirate.shu.edu/~blackdav](http://pirate.shu.edu/~blackdav) | [http://www.rubyconf.com](http://www.rubyconf.com)

---

<div class="post-metadata">

**Author:** ![HAL\_9000](https://avatars.discourse-cdn.com/v4/letter/h/90ced4/32.png) [@HAL\_9000](https://rubytalk.org/u/HAL_9000)\
**Post date:** [20 September 2002 21:06 UTC](https://rubytalk.org/t/string-interpolation-at-will/1894/7 "2002-09-20T21:06:52Z")

</div>

To reply to myself: I’ve just remembered why  
this is nontrivial in pure Ruby. If you write  
a String#interpolate, it can’t get to your  
local variables, i.e. if you do:

bar = “secret”  
foo = ‘code is #{bar}’  
str = foo.interpolate

it won’t work because #interpolate can’t see  
the bar variable. Hmm.

You can still do it outside of a method, of  
course.

I’m playing with a Proc now out of curiosity.

Hal

> **···**
>
> ----- Original Message -----  
> From: “Hal E. Fulton” [hal9000@hypermetrics.com](mailto:hal9000@hypermetrics.com)  
> To: “ruby-talk ML” [ruby-talk@ruby-lang.org](mailto:ruby-talk@ruby-lang.org)  
> Sent: Friday, September 20, 2002 3:30 PM  
> Subject: Re: String interpolation at will?
> 
> > Hmm, there have been times I wished for a String.interpolate  
> > method… couldn’t be too hard to expose it. Wonder if it’s  
> > worth it?

---

<div class="post-metadata">

**Author:** ![Gavin\_Sinclair](https://avatars.discourse-cdn.com/v4/letter/g/db5fbb/32.png) [@Gavin\_Sinclair](https://rubytalk.org/u/Gavin_Sinclair)\
**Post date:** [23 September 2002 21:08 UTC](https://rubytalk.org/t/string-interpolation-at-will/1894/8 "2002-09-23T21:08:47Z")

</div>

Isn’t that what $SAFE is all about?

Gavin

> **···**
>
> ----- Original Message -----  
> From: “Hal E. Fulton” [hal9000@hypermetrics.com](mailto:hal9000@hypermetrics.com)
> 
> > Danger is always an issue… guess it’s not so bad as long as  
> > you have control over the data.
> > 
> > Even regular interpolation is potentially dangerous:
> > 
> > string = “Hi, my name is #{format\_hard\_drive\_and\_return\_name()}.”
> > 
> > 🙂
> > 
> > Hal

---

<div class="post-metadata">

**Author:** ![HAL\_9000](https://avatars.discourse-cdn.com/v4/letter/h/90ced4/32.png) [@HAL\_9000](https://rubytalk.org/u/HAL_9000)\
**Post date:** [20 September 2002 21:17 UTC](https://rubytalk.org/t/string-interpolation-at-will/1894/9 "2002-09-20T21:17:44Z")

</div>

And to answer my own post again, I find that  
this works OK.

Tempted to put ANN: on the subject line. 😉

Code below.

Cheers,  
Hal

# Let’s make a setter for a class variable

class String  
def String.interp=(blk)  
@@interp = blk  
end  
end

# Back to top-level scope

String.interp = (Proc.new do |s|  
\_\_str = s.dup  
\_\_str.gsub!(/“/,‘"’)  
eval('”’ + \_\_str + ‘"’)  
end)

# Now define the methods

class String  
def String.interpolate(str)  
@@interp.call(str)  
end  
def interpolate  
@@interp.call(self)  
end  
end

# Now try it out

str = \<\<‘END’  
He said, “I am the #{alpha} and  
the #{omega}.”  
Have a nice day.

END

puts str

alpha = “walrus”  
omega = “weather is fine”

str2 = str.interpolate  
puts str2

str3 = String.interpolate(str)  
puts str3

And the output is:

He said, “I am the #{alpha} and  
the #{omega}.”  
Have a nice day.

He said, “I am the walrus and  
the weather is fine.”  
Have a nice day.

He said, “I am the walrus and  
the weather is fine.”  
Have a nice day.

> **···**
>
> ----- Original Message -----  
> From: “Hal E. Fulton” [hal9000@hypermetrics.com](mailto:hal9000@hypermetrics.com)  
> To: “ruby-talk ML” [ruby-talk@ruby-lang.org](mailto:ruby-talk@ruby-lang.org)  
> Sent: Friday, September 20, 2002 4:06 PM  
> Subject: Re: String interpolation at will?
> 
> > ----- Original Message -----  
> > From: “Hal E. Fulton” [hal9000@hypermetrics.com](mailto:hal9000@hypermetrics.com)  
> > To: “ruby-talk ML” [ruby-talk@ruby-lang.org](mailto:ruby-talk@ruby-lang.org)  
> > Sent: Friday, September 20, 2002 3:30 PM  
> > Subject: Re: String interpolation at will?
> > 
> > > Hmm, there have been times I wished for a String.interpolate  
> > > method… couldn’t be too hard to expose it. Wonder if it’s  
> > > worth it?
> > 
> > To reply to myself: I’ve just remembered why  
> > this is nontrivial in pure Ruby. If you write  
> > a String#interpolate, it can’t get to your  
> > local variables, i.e. if you do:
> > 
> > bar = “secret”  
> > foo = ‘code is #{bar}’  
> > str = foo.interpolate
> > 
> > it won’t work because #interpolate can’t see  
> > the bar variable. Hmm.
> > 
> > You can still do it outside of a method, of  
> > course.
> > 
> > I’m playing with a Proc now out of curiosity.

---

<div class="post-metadata">

**Author:** ![Michael\_Granger](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@Michael\_Granger](https://rubytalk.org/u/Michael_Granger)\
**Post date:** [21 September 2002 17:52 UTC](https://rubytalk.org/t/string-interpolation-at-will/1894/10 "2002-09-21T17:52:15Z")

</div>

Hal E. Fulton (in "String[#.]interpolate (was Re: String interpolation  
[…]

> And to answer my own post again, I find that  
> this works OK.  
> […]

You can also require a Binding as an argument to #interpolate, and then  
do the eval with it, which allows you to interpolate from arbitrary  
scopes:

class String  
def interpolate( scope )  
unless scope.is\_a?( Binding )  
raise TypeError, "Argument to interpolate must be a Binding,  
not "  
“a #{scope.class.name}”  
end

```
    copy = self.gsub( /"/, %q:\": )
    eval( '"' + copy + '"', scope )
end

```

end

# Test it out:

str = \<\<‘END’  
He said, “I am the #{alpha} and  
the #{omega}.”  
Have a nice day.

END

puts str

alpha = “walrus”  
omega = “weather is fine”

puts str.interpolate( binding )

# Output:

He said, “I am the #{alpha} and  
the #{omega}.”  
Have a nice day.

He said, “I am the walrus and  
the weather is fine.”  
Have a nice day.

> **···**
>
> at will?)") wrote:
> 
> –  
> Michael Granger [ged@FaerieMUD.org](mailto:ged@FaerieMUD.org)  
> Rubymage, Believer, Architect  
> The FaerieMUD Consortium [http://www.FaerieMUD.org/](http://www.FaerieMUD.org/)

---

<div class="post-metadata">

**Author:** ![M\_Mohr](https://avatars.discourse-cdn.com/v4/letter/m/d2c977/32.png) [@M\_Mohr](https://rubytalk.org/u/M_Mohr)\
**Post date:** [23 September 2002 12:16 UTC](https://rubytalk.org/t/string-interpolation-at-will/1894/11 "2002-09-23T12:16:09Z")

</div>

“Hal E. Fulton” [hal9000@hypermetrics.com](mailto:hal9000@hypermetrics.com) writes:

> **···**
>
> > ----- Original Message -----  
> > From: “Hal E. Fulton” [hal9000@hypermetrics.com](mailto:hal9000@hypermetrics.com)  
> > To: “ruby-talk ML” [ruby-talk@ruby-lang.org](mailto:ruby-talk@ruby-lang.org)  
> > Sent: Friday, September 20, 2002 4:06 PM  
> > Subject: Re: String interpolation at will?
> > 
> > > ----- Original Message -----  
> > > From: “Hal E. Fulton” [hal9000@hypermetrics.com](mailto:hal9000@hypermetrics.com)  
> > > To: “ruby-talk ML” [ruby-talk@ruby-lang.org](mailto:ruby-talk@ruby-lang.org)  
> > > Sent: Friday, September 20, 2002 3:30 PM  
> > > Subject: Re: String interpolation at will?
> > > 
> > > > Hmm, there have been times I wished for a String.interpolate  
> > > > method… couldn’t be too hard to expose it. Wonder if it’s  
> > > > worth it?
> > > 
> > > To reply to myself: I’ve just remembered why  
> > > this is nontrivial in pure Ruby. If you write  
> > > a String#interpolate, it can’t get to your  
> > > local variables, i.e. if you do:
> > > 
> > > bar = “secret”  
> > > foo = ‘code is #{bar}’  
> > > str = foo.interpolate
> > > 
> > > it won’t work because #interpolate can’t see  
> > > the bar variable. Hmm.
> > > 
> > > You can still do it outside of a method, of  
> > > course.
> > > 
> > > I’m playing with a Proc now out of curiosity.
> > 
> > And to answer my own post again, I find that  
> > this works OK.
> > 
> > Tempted to put ANN: on the subject line. 😉
> > 
> > Code below.
> > 
> > Cheers,  
> > Hal
> > 
> > # Let’s make a setter for a class variable
> > 
> > class String  
> > def String.interp=(blk)  
> > @@interp = blk  
> > end  
> > end
> > 
> > # Back to top-level scope
> > 
> > String.interp = (Proc.new do |s|  
> > \_\_str = s.dup  
> > \_\_str.gsub!(/“/,‘"’)  
> > eval('”’ + \_\_str + ‘"’)  
> > end)
> > 
> > # Now define the methods
> > 
> > class String  
> > def String.interpolate(str)  
> > @@interp.call(str)  
> > end  
> > def interpolate  
> > @@interp.call(self)  
> > end  
> > end
> > 
> > # Now try it out
> > 
> > str = \<\<‘END’  
> > He said, “I am the #{alpha} and  
> > the #{omega}.”  
> > Have a nice day.
> > 
> > END
> > 
> > puts str
> > 
> > alpha = “walrus”  
> > omega = “weather is fine”
> > 
> > str2 = str.interpolate  
> > puts str2
> > 
> > str3 = String.interpolate(str)  
> > puts str3
> > 
> > And the output is:
> > 
> > He said, “I am the #{alpha} and  
> > the #{omega}.”  
> > Have a nice day.
> > 
> > He said, “I am the walrus and  
> > the weather is fine.”  
> > Have a nice day.
> > 
> > He said, “I am the walrus and  
> > the weather is fine.”  
> > Have a nice day.
> 
> very nice. but, unless i am missing something, there is just one flaw:  
> String.interp is always called in global context. you cannot use  
> String.interpolate inside a method and use local variables there.
> 
> have fun  
> messju

---

<div class="post-metadata">

**Author:** ![HAL\_9000](https://avatars.discourse-cdn.com/v4/letter/h/90ced4/32.png) [@HAL\_9000](https://rubytalk.org/u/HAL_9000)\
**Post date:** [23 September 2002 13:28 UTC](https://rubytalk.org/t/string-interpolation-at-will/1894/12 "2002-09-23T13:28:59Z")

</div>

> very nice. but, unless i am missing something, there is just one flaw:  
> String.interp is always called in global context. you cannot use  
> String.interpolate inside a method and use local variables there.

Perhaps you are right. I don’t have time  
to look at it right now.

Can you show me an example of something  
that fails?

Hal

> **···**
>
> ----- Original Message -----  
> From: “M Mohr” [messju@lammfellpuschen.de](mailto:messju@lammfellpuschen.de)  
> Newsgroups: comp.lang.ruby  
> To: “ruby-talk ML” [ruby-talk@ruby-lang.org](mailto:ruby-talk@ruby-lang.org)  
> Sent: Monday, September 23, 2002 7:16 AM  
> Subject: Re: String[#.]interpolate (was Re: String interpolation at will?)

---

<div class="post-metadata">

**Author:** ![ts1](https://avatars.discourse-cdn.com/v4/letter/t/a8b319/32.png) [@ts1](https://rubytalk.org/u/ts1)\
**Post date:** [23 September 2002 15:27 UTC](https://rubytalk.org/t/string-interpolation-at-will/1894/13 "2002-09-23T15:27:16Z")

</div>

> Can you show me an example of something  
> that fails?

pigeon% cat b.rb  
#!/usr/bin/ruby  
class String  
&nbsp;&nbsp;&nbsp;def String.interp=(blk)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@@interp = blk  
&nbsp;&nbsp;&nbsp;end  
end  
&nbsp;&nbsp;  
# Back to top-level scope  
String.interp = (Proc.new do |s|  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\_\_str = s.dup  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\_\_str.gsub!(/"/,'\"')  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;eval('"' + \_\_str + '"')  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end)  
&nbsp;&nbsp;  
# Now define the methods  
class String  
&nbsp;&nbsp;&nbsp;def String.interpolate(str)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@@interp.call(str)  
&nbsp;&nbsp;&nbsp;end  
&nbsp;&nbsp;&nbsp;def interpolate  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@@interp.call(self)  
&nbsp;&nbsp;&nbsp;end  
end

def aa  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;str = \<\<'END'  
He said, "I am the #{alpha} and  
the #{omega}."  
Have a nice day.  
&nbsp;&nbsp;  
END  
&nbsp;&nbsp;&nbsp;puts str  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;alpha = "WALRUS"  
&nbsp;&nbsp;&nbsp;omega = "WEATHER IS FINE"

&nbsp;&nbsp;&nbsp;str2 = str.interpolate  
&nbsp;&nbsp;&nbsp;puts str2

&nbsp;&nbsp;&nbsp;str3 = String.interpolate(str)  
&nbsp;&nbsp;&nbsp;puts str3  
end

alpha = "walrus"  
omega = "weather is fine"

aa  
pigeon%

pigeon% b.rb  
He said, "I am the #{alpha} and  
the #{omega}."  
Have a nice day.  
&nbsp;&nbsp;  
He said, "I am the walrus and  
the weather is fine."  
Have a nice day.  
&nbsp;&nbsp;  
He said, "I am the walrus and  
the weather is fine."  
Have a nice day.  
&nbsp;&nbsp;  
pigeon%

Guy Decoux

---

<div class="post-metadata">

**Author:** ![HAL\_9000](https://avatars.discourse-cdn.com/v4/letter/h/90ced4/32.png) [@HAL\_9000](https://rubytalk.org/u/HAL_9000)\
**Post date:** [23 September 2002 17:43 UTC](https://rubytalk.org/t/string-interpolation-at-will/1894/14 "2002-09-23T17:43:14Z")

</div>

Of course, stupid of me. This solution  
is useless.

Thanks, Guy.

Hal

> **···**
>
> ----- Original Message -----  
> From: “ts” [decoux@moulon.inra.fr](mailto:decoux@moulon.inra.fr)  
> To: “ruby-talk ML” [ruby-talk@ruby-lang.org](mailto:ruby-talk@ruby-lang.org)  
> Cc: [ruby-talk@ruby-lang.org](mailto:ruby-talk@ruby-lang.org)  
> Sent: Monday, September 23, 2002 10:27 AM  
> Subject: Re: String[#.]interpolate (was Re: String interpolation at will?)
> 
> > > Can you show me an example of something  
> > > that fails?
