The
attached post
Show archive.org snapshot
shows some alternative ways to define Strings in Ruby using the percent notation. This can be useful when you'd like to use quotes ("
) or single-quotes ('
) in your strings:
%(any alpha-numeric)
%[char can be]
%%used as%
%!delimiter\!! # escape '!' literal
%( (pa(re(nt)he)sis) ) #=> "(pa(re(nt)he)sis)"
%[ [square bracket] ] #=> "[square bracket]"
%{ {curly bracket} } #=> "{curly bracket}"
%< <pointy bracket> > #=> "<pointy bracket>"
%< \<this works as well\> > #=> "<this works as well>"
Posted by Henning Koch to makandra dev (2014-07-11 15:43)