How to sort List elements in ColdFusion

ListSort() - sort List elements

ListSort.cfm


<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ListSort function example: how to sort List elements</title>
</head>

<body>
<h2 style="color:hotpink">ListSort Function Example</h2>

<cfset TagList="cfexchangemail,cffeed,cfapplication">
<cfoutput><b>TagList: #TagList#</b></cfoutput>

<br /><br />
<cfoutput>
<b>
TagList[sorted ascending]: #ListSort(TagList,"text","asc",",")#
<br />
TagList[sorted descending]: #ListSort(TagList,"text","desc",",")#
</b>
</cfoutput>
</body>
</html>





Related ColdFusion examples