Hi all,<br><br>Some of you may find this useful. It is a class I wrote that acts like the way strings do in JavaScript. It is a little buggy, and not complete, but could be useful.<br><br>class jsString:<br> def __init__(self,string):
<br> if string.__class__ is list:<br> print "list:",string<br> self.list=string<br> else:<br> print "string:",string<br> self.list=[string]<br>
def __add__(self,other):<br> try:<br> r=self.list[:-1]+[self.list[-1]+other]<br> except:<br> r=self.list+[other]<br> return jsString(r)<br> def __mul__(self,other):<br> try:
<br> r=self.list[:-1]+[self.list[-1]*other]<br> except:<br> r=self.list*other<br> return jsString(r)<br> def __len__(self):<br> return len(str(self))<br> def __str__(self):
<br> r=""<br> for obj in self.list:<br> r+=str(obj)<br> return r<br> def __repr__(self):<br> return str(self.list)<br><br>