[thelist] completing the alphabet
Warden, Matt
mwarden at mattwarden.com
Sun Aug 12 00:16:35 CDT 2001
On Aug 12, Marc Seyon had something to say about [thelist] completing the...
>Looking for some suggestions on how to accomplish this seemingly simple task:
>
>I've got a list of letters, eg E L N R S T in an array (sorted alphabetically)
>What I want to do is fill in the rest of letters in the alphabet, but in
>lower case.
>
>So this list will become "a b c d E f g h i j k L m N o p q R S T u v w x y z"
>
>Note, each letter will be a separate item in the array.
>
>I'm using VBScript/ASP.
I think you're wasting resources if you're using an array to do the
replacing. I think: use a string, then split into an array. Here's an
example with variable names long an descriptive to make sure this is easy
to understand. You'll want to think of better ones, probably, that fit
better with what you're doing exactly.
myABCs = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z"
ucaseLetters = "E,L,N,R,S,T"
ary_ucase = Split(ucaseLetters, ",")
for i = 0 to ubound(ary_ucase)
sLetter=ary_ucase(i)
myABCs = replace(myABCs, lcase(sLetter), sLetter, 1, 1)
sLetter = Empty ' this is me being anal
next
myABCs should now have what you want and you can easily make it an array
with:
ary_ABCs = Split(myABCs, ",")
that is, if you need it to be an array.
ps. I've never typed the alphabet before. i must say it was fun.
good luck,
--
mattwarden
mattwarden.com
More information about the thelist
mailing list