VBScript

Better dan Fast Concatenations


Example :

Function TableContent(…)
Dim strContent(30)
‘sub to clear the content string
ClearString strContent 

Do While Not recordset.EOF
‘add to the result string
AddString strContent,recordset.Fields([cell]) 
Loop
TableContent = fnReadString(strContent)
End Function



Sub AddString(part, newString)
      Dim tmp as string
      Dim index as integer

      part(0) = part(0) & newString
      If Len(part(0)) > 30 Then
            index = 0
            tmp = “”
            Do
                  tmp = part(index) & tmp
                  part(index) = “”
                  index = index + 1
            Loop until part(index) = “”
            part(index) = tmp
      End If

End Sub


Function fnReadString(part)
      Dim tmp as string
      Dim index as integer
      tmp = “”
      For index = 0 to 30
            If part(index) <> “” Then
                  tmp = part(index) & tmp
            End If
      Next
      FnReadString = tmp

End Function


Sub ClearString(part)
      Dim index as integer
      For index = 0 to 30
            part(index) = “”
      Next
End Sub


Source : http://www.planet-source-code.com/vb/scripts/ShowCode.asp?lngWId=4&txtCodeId=7110

About Gafur

Diberdayakan oleh Blogger.