Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFLoop and Letters

Status
Not open for further replies.

CFTyrant

Programmer
Mar 25, 2002
13
US
I'm creating a form that will allow the users to search thorugh a database of registered users based on the first letter of their last name.

I don't want to create a drop down of A-Z, so I tried to use a CFLoop using From="A" to="Z" - that didn't work.

From my research, there doesn't appear to be a way to get CFLoop to work with anything but numbers. Now I know that each letter has an ascii code representation, if memory servers A is 65.

So if I were to loop from 65 to 81 and then have CF output the character of 65 (which in other languages that I'm more familiar with would be like CHR(65)) - I'd get my letter A.

How (or is it even possible) do I do the equivalent of CHR(#VALUE#) in CF?

Thanks!
 
<CFOUTPUT><CFLOOP list=&quot;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&quot; index=&quot;currletter&quot;>#CurrLetter#</CFLOOP></CFOUTPUT>

or...

<CFOUTPUT><CFLOOP from=&quot;65&quot; to=&quot;81&quot; index=&quot;digit&quot;>#chr(digit)#</CFLOOP></CFOUTPUT>

might also do it...

hope this helps,

Tony
 
I think this is what you are looking for:

<cfloop from=&quot;65&quot; to=&quot;90&quot; index=&quot;i&quot;>
<cfoutput>#chr(i)#<br></cfoutput>
</cfloop>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top