Drew Wutka
DWUTKA at Marlow.com
Thu Jan 28 11:43:36 CST 2010
I don't think Charlotte left an OR part out of her statement.... ;)
Drew
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Max Wanadoo
Sent: Thursday, January 28, 2010 11:04 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] A2003:Replacing 'tokens' in a string
Haha, I think you missed the "OR" part out, Charlotte,
"OR you will be assimilated"
Thanks for the heads up, Janeway. Or should that be 7 of 9?
Max
Ps. Head down, learning, learning...
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte
Foust
Sent: 28 January 2010 16:53
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] A2003:Replacing 'tokens' in a string
The point you're missing is that a routine to parse a string is *part*
of a
string-handling class. Get used to the idea of classes Max. You will
be
assimilated.
Charlotte Foust
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Max Wanadoo
Sent: Thursday, January 28, 2010 12:46 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] A2003:Replacing 'tokens' in a string
Yes, to make it more flexible and robust it wouldn't take much more
work
on yours, mine or Keith's submissions.
But, I would not go the class route just to parse a string, which is
the
point I am really making.
Horses for Courses and each to their own. For me KISS works.
Thanks
Max
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Shamil
Salakhetdinov
Sent: 28 January 2010 06:57
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] A2003:Replacing 'tokens' in a string
Max,
How about that? (To satisfy original request of getting extracted just
AccountNo and InvoiceNo out of the source string.)
Dim s As String
s = "[AccountNo]=1234," + _
"[InvoiceNo]=1234567," + _
"[InvoiceDate]=04/01/2010,[Name]=Barry"
Debug.Print Val(Mid(s, InStr(s, "[InvoiceNo]") + 12))
Debug.Print Val(Mid(s, InStr(s, "[AccountNo]") + 12))
Yes, it's not "bullet-proof" but if the source string is guaranteed to
have
specified format then that simple approach will work well.
Please don't start telling (you will not I expect but others here can I
guess :)) "we all know how "specified formats" can often change" - just
program against the current requirements and wait for the other day and
new
requirements to come - that's is the current mainstream trend in agile
Test
Driven Development...
We can spend a lot of time discussing what is the probability of the
specified source string format to change, and how to "bullet-proof" the
above lightweight coding(?) approach - should we? - that's not a
rhetoric
question, folks - your opinions coming from your experience is wanted
and
very welcome...
Thank you :)
--
Shamil
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Max Wanadoo
Sent: Thursday, January 28, 2010 8:54 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] A2003:Replacing 'tokens' in a string
Yes John/Drew but why use that horrendous code when you can do the same
with
this..
Call
xsplit("[AccountNo]=1234,[InvoiceNo]=1234567,[InvoiceDate]=04/01/2010,[N
ame]
=Barry")
Function xSplit(str as string)
Dim arr() As String, i As Integer
arr = Split(str, ",")
Debug.Print arr(0), arr(1), arr(2), arr(3) 'Done!
'if you want the values then this next bit will do that
For i = 0 To 3
arr(i) = Mid(arr(i), InStr(arr(i), "=") + 1)
Debug.Print arr(i),
Next i
End Function
A person cannot go through life taking the more obtuse form of coding
just
so that they may "learn" something new.
It is all about getting the code out.
I am with Stuart on this.
Max
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of jwcolby
Sent: 28 January 2010 02:02
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] A2003:Replacing 'tokens' in a string
LOL
Stuart, I think you misunderstand. We all recommend that you do the
minimum
amount of work
necessary and stay ignorant the rest of your life. It has worked for me
for
all these many years.
Why in the world would you want to take an opportunity and actually
LEARN
something?
;)
John W. Colby
www.ColbyConsulting.com
Stuart McLachlan wrote:
> At last! someone else who does it with a few lines of simple code
rather
than vastly over-
> engineering the solution :-)
>
--
__________ Information from ESET NOD32 Antivirus, version of virus
signature
database 4812 (20100128) __________
The message was checked by ESET NOD32 Antivirus.
http://www.esetnod32.ru
--
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
The information contained in this transmission is intended only for the person or entity
to which it is addressed and may contain II-VI Proprietary and/or II-VI Business
Sensitive material. If you are not the intended recipient, please contact the sender
immediately and destroy the material in its entirety, whether electronic or hard copy.
You are notified that any review, retransmission, copying, disclosure, dissemination,
or other use of, or taking of any action in reliance upon this information by persons
or entities other than the intended recipient is prohibited.