How to get the last element of a list in ColdFusion

ListLast() - get the last element of a list

ListLast.cfm


<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ListLast function example: how to get the last element of a list</title>
</head>

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

<cfset ColorList="Green,GreenYellow,HoneyDew">
<cfoutput><b>ColorList: #ColorList#</b></cfoutput>

<br /><br />
<cfoutput><b>ColorList Last Element: #ListLast(ColorList,",")#</b></cfoutput>
</body>
</html>





More ColdFusion examples