Looping through A to Z in ColdFusion

There are always more than single methods to accomplish the same job in programming language. To loop through the letters from A to Z in ColdFusion there are also more than one way, but I personally found out the following 2 methods are simpler and strain forward.


Hardcode the A to Z into a list and just loop over it






<cfdump var=”#strLetter#”>





The other way to loop through the letters is using the ASCII value from A to Z. We first convert the A and Z to ASCII, than just use the number to loop through the rest and convert it back to char to get back our result.




from=”#Asc( ‘A’ )#”

to=”#Asc( ‘Z’ )#”



<!— Get character of the given ascii value. —>

<cfset strLetter = Chr( intLetter ) />


<cfdump var=”#strLetter#”>




Please feel free to share the way you usually use or you may found out any other better way to do the job.

Leave a Reply

google.com, pub-3772983857049267, DIRECT, f08c47fec0942fa0
%d bloggers like this: