Skip to main content

Posts

Showing posts with the label list

How to count instances of a specified value in a List (case sensitive) in ColdFusion

ListValueCount() - count instances of a specified value in a List (case sensitive) ListValueCount.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>ListValueCount function example: how to count instances of a specified value in a List (case sensitive)</title> </head> <body> <h2 style="color:hotpink">ListValueCount Function Example</h2> <cfset TagList="cfindex,cfabort,cfindex,cfapplication,CFindex"> <cfoutput><b>TagList: #TagList#</b></cfoutput> <br /><br /> <cfoutput><b>TagList[cfindex List value count]: #ListValueCount(TagList,"cfindex",",")#</b></cfoutput> </body> </html> More ColdFusion examples ListFind() - find List element (case sensitive) ListFindNoCase() - fin...

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 ListAppend() - add element at the end of a List ListChangeDelims() - change List...

ColdFusion - How to get total number of elements in a List

ListLen() - get total number of elements in a List ListLen.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>ListLen function example: how to get total number of elements in a List</title> </head> <body> <h2 style="color:hotpink">ListLen Function Example</h2> <cfset TagList="cfquery,cfset,cfexit,cfindex"> <cfoutput><b>TagList: #TagList#</b></cfoutput> <br /><br /> <cfoutput><b>TagList[Total List Element]: #ListLen(TagList,",")#</b></cfoutput> </body> </html> More ColdFusion examples ListFind() - find List element (case sensitive) ListFindNoCase() - find List element (case insensitive) ListFirst() - get the first element of a List ListGetAt() - get List element at a specified p...

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 ListAppend() - add element at the end of a List ListChangeDelims() - change List delimiter ListDeleteAt() - delete List element at specific position ListLen() - get total number of elements in a List

How to get List element at a specified position in ColdFusion

ListGetAt() - get List element at a specified position ListGetAt.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>ListGetAt function example: how to get List element at a specified position</title> </head> <body> <h2 style="color:hotpink">ListGetAt Function Example</h2> <cfset ColorList="FloralWhite,ForestGreen,Fuchsia,Gainsboro"> <cfoutput><b>ColorList: #ColorList#</b></cfoutput> <br /><br /> <cfoutput><b>ColorList Element At Position 3: #ListGetAt(ColorList,3,",")#</b></cfoutput> </body> </html> More ColdFusion examples ListAppend() - add element at the end of a List ListChangeDelims() - change List delimiter ListFindNoCase() - find List element (case insensitive) ListFirst...

How to get the first element of a List in ColdFusion

ListFirst() - get the first element of a List ListFirst.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>ListFirst function example: how to get the first element of a List</title> </head> <body> <h2 style="color:hotpink">ListFirst Function Example</h2> <cfset ColorList="DimGray,DodgerBlue,FireBrick"> <cfoutput><b>ColorList: #ColorList#</b></cfoutput> <br /><br /> <cfoutput><b>ColorList First Element: #ListFirst(ColorList,",")#</b></cfoutput> </body> </html> More ColdFusion examples ListAppend() - add element at the end of a List ListFindNoCase() - find List element (case insensitive) ListGetAt() - get List element at a specified position ListLast() - get the last element of ...

How to find List element (case insensitive) in ColdFusion

Introduction In Adobe ColdFusion, working with lists is a common task, especially when developers need to manage multiple items stored in a single variable. When handling lists, case sensitivity often becomes an obstacle, as ColdFusion's default behavior is case-sensitive in its searches. To address this issue, ColdFusion offers a built-in function called ListFindNoCase , which allows developers to search for elements within a list without worrying about letter case differences. This tutorial demonstrates how to use the ListFindNoCase function by implementing a simple example where we locate specific color names within a list. Setting Up the List and Displaying It In this example, we begin by defining a variable, ColorList , which contains a series of color names separated by commas. These colors are listed in mixed casing to simulate real-world data, where inconsistencies in capitalization may arise. Displaying the list at the start helps users understand the elements stored with...

How to find List element (case sensitive) in ColdFusion

ListFind() - find List element (case sensitive) ListFind.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>ListFind function example: how to find List element (case sensitive)</title> </head> <body> <h2 style="color:hotpink">ListFind Function Example: Case-sensitive</h2> <cfset ColorList="DarkViolet,DeepPink,DarkViolet,DeepSkyBlue"> <cfoutput><b>ColorList: #ColorList#</b></cfoutput> <br /><br /> <table style="color:LightGreen; background:Green;" border="1" bordercolor="DarkGreen"> <tr> <td style="font-weight:bold">ListFind Case-sensitive</td> <td style="font-weight:bold">Output</td> </tr> <tr> <td>#List...

How to delete List element at specific position in ColdFusion

ListDeleteAt() - delete List element at specific position ListDeleteAt.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>ListDeleteAt function example: how to delete List element at specific position</title> </head> <body> <h2 style="color:hotpink">ListDeleteAt Function Example</h2> <cfset ColorList="DarkSlateBlue,DarkSlateGray,DarkTurquoise"> <cfoutput><b>ColorList: #ColorList#</b></cfoutput> <br /><br /> <cfset ColorList=ListDeleteAt(ColorList,2,",")> <cfoutput><b>ColorList[After delete position 2]: #ColorList#</b></cfoutput> </body> </html> More ColdFusion examples ListFind() - find List element (case sensitive) ListLast() - get the last element of a list ListLen() - g...

How to change List delimiter in ColdFusion

ListChangeDelims() - change List delimiter ListChangeDelims.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>ListChangeDelims function example: how to change List delimiter</title> </head> <body> <h2 style="color:hotpink">ListChangeDelims Function Example</h2> <cfset ColorList="DarkRed,DarkSalmon,DarkSeaGreen"> <cfoutput><b>ColorList: #Colorlist#</b></cfoutput> <br /> <cfset Temp = ListChangeDelims(ColorList,";",",")> <cfoutput><b>Temp[New Delimiter ;]: #Temp#</b></cfoutput> </body> </html> More ColdFusion examples ListAppend() - add element at the end of a List ListLast() - get the last element of a list ListLen() - get total number of elements in a List ListSort(...

How to add an element at the end of a List in ColdFusion

Introduction In Adobe ColdFusion, lists are a common data structure used to store multiple values in a single variable, separated by a delimiter (usually a comma). Lists are efficient for handling simple data without the need for more complex structures like arrays or objects. One useful function in ColdFusion for managing lists is ListAppend , which enables developers to add new elements to the end of an existing list easily. In this example, we will walk through how to use the ListAppend function to expand a list of colors by appending a new color to it. This tutorial is particularly helpful for developers looking to handle list data dynamically. It demonstrates how to initialize a list, display it, use ListAppend to modify the list, and show the modified version on a webpage. Setting Up the Initial List The example begins by creating a list of colors stored in the variable ColorList . This list is initialized with three colors: "DarkMagenta," "DarkOliveGreen," ...