[AccessD] Treat string as array

jwcolby jwcolby at colbyconsulting.com
Wed Mar 26 23:50:41 CDT 2008


Yea, but Gustav's solution (to my actual question) was precisely what I
needed. 


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 pcs at azizaz.com
Sent: Thursday, March 27, 2008 12:33 AM
To: Access Developers discussion and problemsolving
Subject: Re: [AccessD] Treat string as array

Four days later trailing behind..
Tested out Gustav's painful exercise... learned something new

Then had to revisit the split... 
As John says without a delimiter, the Split function doesn't do much.

If Delimeter is omitted " " (space) is assumed.
If Delimeter is provided as "" (zero length string) the whole expression is
returned....

>From the VBA Help :
Split(expression[, delimiter[, limit[, compare]]])

The Split function syntax has these named arguments:

Part Description
expression Required. String expression containing substrings and delimiters.
If expression is a zero-length string(""), Split returns an empty array,
that is, an array with no elements and no data. 
delimiter Optional. String character used to identify substring limits. If
omitted, the space character (" ") is assumed to be the delimiter. If
delimiter is a zero-length string, a single-element array containing the
entire expression string is returned. 
limit Optional. Number of substrings to be returned; -1 indicates that all
substrings are returned. 
compare Optional. Numeric value indicating the kind of comparison to use
when evaluating substrings. See Settings section for values. 

borge


---- Original message ----
>Date: Sat, 22 Mar 2008 22:00:28 -0400
>From: "jwcolby" <jwcolby at colbyconsulting.com>
>Subject: Re: [AccessD] Treat string as array
>To: "'Access Developers discussion and problem solving'" 
<accessd at databaseadvisors.com>
>
>Split only works when the string contains "words" or
delimited strings.  It
>does nothing if it is all one big string of characters. 
>
>
>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
William Hindman
>Sent: Saturday, March 22, 2008 8:47 PM
>To: Access Developers discussion and problem solving
>Subject: Re: [AccessD] Treat string as array
>
>...Split(<string>)
>...works in 2k+
>...hth
>
>William
>
>----- Original Message -----
>From: "jwcolby" <jwcolby at colbyconsulting.com>
>To: "'Access Developers discussion and problem solving'" 
><accessd at databaseadvisors.com>
>Sent: Saturday, March 22, 2008 6:30 PM
>Subject: Re: [AccessD] Treat string as array
>
>
>>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
>>
>> --
>> 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
>
>--
>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