Question
Setting a comma in a dynamic list build
Hi Guys, can anyone please help me with this issue. I want to
take a list and find the last characters in the list and then build
another list. With this other list I am having a problem not
dropping a comma after the last element.
I am expecting this y,n I am getting y,n,
Here is my code.
<cfset initials = " ">
<cfset george = "hary,martin">
<cfset showComma = false>
<Cfloop index="name" list="#george#" delimiters=",">
<cfset initials = initials & right(name,1) & "<cfif showComma>,<cfelse><cfset showComma = true></cfif>">
</cfloop>
I am expecting this y,n I am getting y,n,
Here is my code.
<cfset initials = " ">
<cfset george = "hary,martin">
<cfset showComma = false>
<Cfloop index="name" list="#george#" delimiters=",">
<cfset initials = initials & right(name,1) & "<cfif showComma>,<cfelse><cfset showComma = true></cfif>">
</cfloop>