[PD] string manipulation
matju at sympatico.ca
Sat Mar 5 20:35:04 CET 2005
On Sat, 5 Mar 2005 ix at 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..
class RESub < GridFlow::FObject
@a = Regexp.new a.to_s
@b = b.to_s
def _0_symbol c
send_out 0, :symbol, c.to_s.sub(@a, at b).intern
install "re_sub", 1, 1
if you want multiple substitutions, just replace .sub by .gsub
Mathieu Bouchard -=- Montréal QC Canada -=- http://artengine.ca/matju
More information about the Pd-list