> >aa=CREATEOBJECT("stringbuilder") >scan > aa.append(yourstring) >endscan > >return aa.getstring() > >DEFINE CLASS stringbuilder AS acusbase OF aappcontrols.prg > #if .f. > local this as stringbuilder of stringbuilder.prg > #endif > > nBlockSize = 64*1024 > nNextChar = 0 > nAllowcated = 0 > nPointer = 0 > > FUNCTION init(tnInitSize) > LOCAL llRet > llRet = .t. > DECLARE Long GetProcessHeap IN Win32API > DECLARE Long HeapAlloc IN Win32API Long, Long, Long > IF VARTYPE(m.tnInitSize) == "N" > this.nallowcated = tnInitSize > ELSE > this.nallowcated = this.nblocksize > ENDIF > this.npointer = HeapAlloc(GetProcessHeap(),0,this.nallowcated) > this.nNextchar = this.npointer > IF this.npointer = 0 > ERROR "out of memory" > ENDIF > return llRet > ENDFUNC > > FUNCTION destroy() > LOCAL llRet > llRet = .t. > DECLARE Long GetProcessHeap IN Win32API > DECLARE Long HeapFree IN Win32API Long, Long, Long > IF this.npointer <> 0 > HeapFree(GetProcessHeap(),0,this.npointer) > ENDIF > return llRet > ENDFUNC > > FUNCTION append(tcString) > LOCAL llRet , lnLength, lnSize > llRet = .t. > DECLARE Long GetProcessHeap IN Win32API > DECLARE Long HeapReAlloc IN Win32API Long, Long, Long, Long > lnLength = LEN(m.tcString) > IF this.nNextchar+m.lnLength > this.npointer+this.nallowcated > lnSize = this.nNextchar - this.npointer > this.nallowcated = this.nallowcated + this.nBlockSize > this.nPointer = HeapReAlloc(GetProcessHeap(),0,this.npointer,this.nallowcated) > IF this.npointer = 0 > ERROR "Out of memory" > ENDIF > this.nnextchar = this.npointer + m.lnSize > ENDIF > SYS(2600,this.nnextchar,m.lnLength,m.tcString) > this.nnextchar = this.nnextchar + m.lnLength > return llRet > ENDFUNC > > FUNCTION getstring() > LOCAL lcRet > lcRet = SYS(2600,this.npointer,this.nnextchar-this.npointer) > return lcRet > ENDFUNC > >ENDDEFINE > >>