Local loString , lcString nStart = Seconds() loString = CreateObject("StringBuilder") For i = 1 TO 1000 loString.Add(Replicate("A", 1024)) EndFor lcString = loString.Get() ? Len(lcString) ? Seconds()-nStart Define Class StringBuilder As Line Protected nHandle, cFile Protected Function INIT() This.cFile = Addbs(Sys(2023))+Sys(2015) This.nHandle = Fcreate( This.cFile ) EndFunc Function Add( cString ) =Fwrite( This.nHandle, cString ) EndFunc Function Get() Local lcRet If This.nHandle > 0 =Fclose( This.nHandle ) lcRet = FileToStr( This.cFile ) Erase (This.cFile) This.nHandle = 0 Else lcRet = "" Endif Return lcRet EndFunc Protected Function Destroy() If This.nHandle > 0 =Fclose( This.nHandle ) If File(This.cFile) Erase (This.cFile) Endif This.nHandle = 0 EndIf EndFunc EndDefineUsing this class, i never have to worry about the speed even with very large string.
lcResult = "<table>" >n = afields( laFields ) >scan > lcRow = "<tr>" > for i = 1 to n > lcRow = lcRow + "<td>" + transform( eval( laFields[i,1] ) ) + "</td>" > endfor > lcResult = lcResult + lcRow + "</tr>" >endscan > >lcResult = lcResult + "</table>" >>
lcResult = "<table>" >scan > n = afields( laFields ) > lcResult = lcResult + "<tr>" > for i = 1 to n > lcResult = lcResult + "<td>" + > lcResult = lcResult + transform( eval( laFields[i,1] ) ) > lcResult = lcResult + "</td>" > endfor > lcResult = lcResult + "</tr>" >endscan > >lcResult = lcResult + "</table>" >>