[AccessD] Find characters in one string that are in another:w asRE: Treat string as array

Heenan, Lambert Lambert.Heenan at AIG.com
Tue Mar 25 10:14:57 CDT 2008


But John, didn't you see Gustav's response very early on in the thread
suggesting you use StrConv? Armed with that clue your dream of using a
simple for next loop is easily achieved...

Function StringArray(str As String) As Variant
Dim byArray() As Byte
    byArray = StrConv(str, vbFromUnicode)
    StringArray = byArray
End Function

Sub PlayWithStringArray(str As String)
Dim byArray() As Byte
Dim c As Variant
    byArray = StringArray(str)
    For Each c In byArray()
        Debug.Print c; " "; Chr(c);
    Next c
    Debug.Print vbCrLf; str
End Sub

You're on the money though about the number of answers that seemed not to be
connected with the question! :-)

Lambert

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of jwcolby
Sent: Tuesday, March 25, 2008 11:01 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Find characters in one string that are in
another:wasRE: Treat string as array


LOL.  

Turn a string into an array.  Turn a string into an ARRAY.  TURN A STRING
INTO AN ARRAY.  

That was my question.  Why I want to do it is irrelevant.

And yea, Regex probably would work, but I did not have time to spend a week
learning a useful but EXTREMELY arcane syntax to solve a 5 minute problem.
In fact I didn't have time to answer 25 suggestions having nothing to do
with TURNING A STRING INTO AN ARRAY. 

Sigh.

;-)

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 Max Wanadoo
Sent: Tuesday, March 25, 2008 10:43 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Find characters in one string that are in
another:wasRE: Treat string as array

Aha!  Now we get the question...

>I was trying to search for characters in a password that are also in a
"must contain" string.
>"The password must contain one 'special character' ~!@#$%^&*()_+ and
>the
password must contain one 'number' 1234567890.
>Given a password "The thread that went south", how do I determine if it
contains any special characters or numbers.

Whew!  Took a while to drag it out of him folks but we got there in the end.
Moral: Give JC rubbish answers, he gets frustrated, QED he posts the correct
question.  Rolls Eyes!

JC: Don't know if RegExp will solve it elegantly ;-) but worth a sly glance.

Max

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