On Sat, 5 Mar 2005 ix@replic.net wrote:
On Sat, Mar 05, 2005 at 10:20:55AM -0500, david golightly wrote:
hey all -
does anyone know of any basic string manipulation tools for PD, enabling contruction of symbols from character-atoms? if not, i might be interested in writing a set of externals, but i don't want to duplicate anyone's work.
you can't do strings in pd. however, you can do symbols - you can probbaly do what you want with l2s/s2l from zexy and sprintf from cyclone unless your needs are insane - then you can try 'echo $1 | sed -e blahblah' with [shell], or pyext or tot (Tcl)...
a 'sed' external would be cool..
here's one.
class RESub < GridFlow::FObject def initialize(a,b) @a = Regexp.new a.to_s @b = b.to_s end def _0_symbol c send_out 0, :symbol, c.to_s.sub(@a,@b).intern end install "re_sub", 1, 1 end
if you want multiple substitutions, just replace .sub by .gsub
Mathieu Bouchard -=- Montréal QC Canada -=- http://artengine.ca/matju