Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Replace or append items in coldfusioin string

Posted on 2014-04-18
3
Medium Priority
?
248 Views
Last Modified: 2014-04-18
I have a form with some checkboxes. When the form is submitted, the items are saved as a string and separated by commas. So if the checkboxes for "bob", "larry" and "greg" were selected the form value is: bob,larry,greg

I need to take each of those values and add "@mycomp.com" and separate them with semi colons (except the last one). So, they would be: bob@mycomp.com; larry@mycomp.com; greg@mycomp.com

I'd also like to create a list with the values after they are set with the @mycomp.com.

Could someone assist?

Thank you.
0
Comment
Question by:earwig75
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 2000 total points
ID: 40009533
Something like ...

<!--- change delimiter from "," to "@mycomp.com;" --->
<cfset newList = arrayToList(listToArray(FORM.theFieldName), "@mycomp.com;")>
<cfif listLen(newList, ";")>
     <!--- append "@mycomp.com" to last element --->
     <cfset newList = newList &"@mycomp.com">
</cfif>
0
 

Author Closing Comment

by:earwig75
ID: 40009564
You're the best.
0
 
LVL 52

Expert Comment

by:_agx_
ID: 40009658
Thanks. Glad I could help :)
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question