John Salerno wrote:

> Out of curiosity, is there any kind of equivalent in Python to the
> StringBuilder class in C#?

You can just append each string to a list and call "".join(list) on the
list. Here is a mock-up StringBuilder class:

class StringBuilder:
        def __init__(self): self.strlist = list()
        def Append(self,str): self.strlist.append(str)
        def ToString(self): return "".join(self.strlist)

Implementing the rest of the .NET StringBuilder class is left as an
exercise:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemtextstringbuilderclasstopic.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemtextstringbuildermemberstopic.asp

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to