[thelist] ASP: getting double digits

Tab Alleman talleman at avweb.com
Fri, 21 Jan 2000 15:17:33 -0000


and actually, (just as a matter of personal preference) I think it'd be more
fun to use:

Do While Len(strString) < ExpectedLength
	blah
	blah
	blah
Loop

:)  So many different ways to get Carpal Tunnel Syndrome with VBScript!

-----Original Message-----
From: thelist-admin@lists.evolt.org
[mailto:thelist-admin@lists.evolt.org]On Behalf Of Matt Warden
Sent: Thursday, January 20, 2000 22:26
To: thelist@lists.evolt.org
Subject: Re: [thelist] ASP: getting double digits


> varNow = Now
> strMonth = MakeCorrect(CStr(Month(varNow)), 2)
> strYear = MakeCorrect(Cstr(Year(varNow)), 4)
>
> Function MakeCorrect(strString, ExpectedLength)
>     If Len(strString) = ExpectedLength THEN strString = "0" &
strString

AHHHH!!!! Well, I was just going to fix this one line, but the whole
function needs rewriting.

Function MakeCorrect(strString, ExpectedLength)
    StringLength = len(strString)
    IF StringLength < ExpectedLength THEN
        FOR i = 1 to (ExpectedLength-StringLength)
            strString = strString & "0"
        NEXT
    END IF
    MakeCorrect = strString
END Function

Ok. I feel like I just learned VBScript yesterday :)

<mumble>Damn.... stupid.... mistake... piece of...</mumble>

-Matt


_______________________________________________________
unsubscribe+options: http://lists.evolt.org/mailman/listinfo/thelist
tip harvester: http://lists.evolt.org/harvest/
email archive: http://lists.evolt.org/archive/
http://evolt.org/  Workers of the Web, evolt !