[AccessD] Treat string as array

Heenan, Lambert Lambert.Heenan at chartisinsurance.com
Thu Sep 2 14:48:20 CDT 2010


Silly me. I looked into an old folder and did not notice quite how ancient it was.

Lambert 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, Lambert
Sent: Thursday, September 02, 2010 3:27 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Treat string as array

Fair enough, but is there anything wrong with...


Sub StringItter(str As String)
Dim n As Long


For n = 1 To Len(str)
    'dosomething Mid(str, n, 1)
    Debug.Print Mid(str, n, 1)
Next n

End Sub

-----Original Message-----
From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Saturday, March 22, 2008 8:11 PM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Treat string as array

Hi John

Have you forgotten how to read a file into a byte array? It is so easy as it hurts:

Public Function aTest(strA As String)

  Dim abytTest()  As Byte
  Dim intChar     As Integer
  
  abytTest = strConv(strA, vbFromUnicode)
  
  For intChar = LBound(abytTest) To UBound(abytTest)
    Debug.Print abytTest(intChar);
  Next
  Debug.Print
  For intChar = LBound(abytTest) To UBound(abytTest)
    Debug.Print Chr(abytTest(intChar));
  Next
   
End Function

/gustav

>>> jwcolby at colbyconsulting.com 22-03-2008 22:14:56 >>>
How can I turn a string into an array?  I need to iterate through the characters of a string.

For each char in str
	dosomething char
Next char

John W. Colby
Colby Consulting
www.ColbyConsulting.com 



--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list