[rcr] epsilon string escaping in %W()

  • Thread starter Simon Strandgaard
  • Start date
S

Simon Strandgaard

problem:

often I use the %W(a b c d e f) for quickly making an array of strings.
sometimes I need an empty string in that array, and I have to
change the code into %W(a b c) + [''] + %W(d e f).
which doesn't look nice.. and makes me do silly stuff instead.


suggestion:
It would be really nice if it was easier to make empty strings within %W.

for instance slash E could be the empty string
%W(a \E b) #=> ["a", "", "b"]

If no spacing in between.. then output would simply be
%W(a\Eb) #=> ["ab"]
 
S

Simon Strandgaard

problem:

often I use the %W(a b c d e f) for quickly making an array of strings.
sometimes I need an empty string in that array, and I have to
change the code into %W(a b c) + [''] + %W(d e f).
which doesn't look nice.. and makes me do silly stuff instead.

solution:

dblack suggested %W(a b c #{} d e f)

Thansk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top