-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> This is what I came up with.  Anyone have anything any faster?

I'm not sure if this is any faster, but I think it's a little easier
to grok.

It's not in tag form, but should be easy enough to tagify...

Hope this helps.

Best regards,
Zachary Bedell

<!---
ASSume:  Tracking number is a string like:
"1Z12345X421234567"
12345X is the UPS Account
42 is the service level (Ground w/ Signature in this case)
1234567 is your sequence number
The check digit is missing
- --->

<!--- At this point we should have a tracking number, minus
checkdigit.  --->
<!--- Trim off the 1Z --->
<Cfset CheckTrackingNumber = Mid(TrackingNumber, 3,
Len(TrackingNumber) - 2)>
<cfset TheSum = 0>

<cfset LenTrak = Len(CheckTrackingNumber)>
<Cfloop from="1" to="#LenTrak#" index="i">              
        <Cfset TheChar = Mid(CheckTrackingNumber, i,1)> 
        <cfif Not IsNumeric(TheChar)>
                <!--- Handle letter to number conversion --->
                <Cfset TheChar = Asc(TheChar) - 63>
        </cfif>         
                
        <cfif i MOD 2 EQ 0>
                <!--- Even --->
                <cfset TheSum = TheSum + (2 * Int(TheChar))>
        <cfelse>
                <!--- Odd --->
                <Cfset TheSum = TheSum + Int(TheChar)>
        </cfif> 
</cfloop>
<cfset Remain = TheSum MOD 10>
<cfset Check = 10 - Remain>
<Cfif Check EQ 10><cfset Check = 0></cfif>
<Cfset TrackingNumber = TrackingNumber & Check>
<!--- No tracking number has its check digit appended --->


-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.5.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBOV9FWAraVoMWBwRBEQI5LwCgij+D/1gd5yYg3gaawmpfeeyFaJoAn0AM
qIetaKh9+3recuB2SXkNgehD
=C8gi
-----END PGP SIGNATURE-----
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to