9 Replies Latest reply on Mar 21, 2007 1:11 PM by Karthik_Nataraj

    Setting a comma in a dynamic list build

    cutie369 Level 1
      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>