jwcolby
jwcolby at colbyconsulting.com
Tue Mar 25 10:35:24 CDT 2008
Well Heenan, that was well beyond the time when I had already just caved and implemented the mid() solution. I will be going back and rewriting using Gustav's solution, I just haven't had the time yet. The nice thing about this list is that so many people are willing to respond, and I REALLY DO appreciate all responses, just want to get that out. I may grouse a bit but people are willing to take time and make suggestions. And of course we have so many keen minds that someone will have the answer if there is one. Don't you agree that Dim byArray() As Byte Dim c As Variant byArray = StrConv(str, vbFromUnicode) For Each c In byArray() Debug.Print c; " "; Chr(c); Next c Is just an elegant solution? It may not be any faster than the mid() but is sooooo much more readable. Not to mention the fact that once it is in an array you can do all kinds of comparisons on each element. 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 Heenan, Lambert Sent: Tuesday, March 25, 2008 11:15 AM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Find characters in one string that are inanother:w asRE: Treat string as array 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 -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com