[AccessD] Treat string as array

jwcolby jwcolby at colbyconsulting.com
Sat Mar 22 17:30:01 CDT 2008


A for next iterator.

Dim varChar as variant
For each varChar in arrSomeStr
	Do something with varChar
Next varChar 

Much cleaner than

Dim IntPtr
Dim varChar as variant
	for intPtr <=len(strSomeStr)
		varChar = mid(strsomestr,intprt,1)
		So something with VarChar
	next intprt

They both work but...

Strings are just pointers to an memory location on the heap.  Turning a
string into an array of characters SHOULD be a function call, optimized in
assembler to be blindingly fast.

John W. Colby
Colby Consulting
www.ColbyConsulting.com 
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin at
Beach Access Software
Sent: Saturday, March 22, 2008 6:15 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Treat string as array

 
What do you need that you don't get from MID?

Rocky

>
> 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

No virus found in this incoming message.
Checked by AVG. 
Version: 7.5.519 / Virus Database: 269.21.8/1338 - Release Date: 3/21/2008
5:52 PM
 

--
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