[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Coldfusion Comma Delimited Lists - adding a space after comma

Posted on 2011-04-20
4
Medium Priority
?
1,739 Views
Last Modified: 2012-05-11
I have a variable submitted in a form... #form.selectedOrgs#. This can be one item or multiple. It is already a comma delimited list when it is submitted. For example:

#form.selectedOrgs# would be org1,org2,org3,org4

I don't know how to insert a space between the items in the list. Any help would be greatly appreciated!
0
Comment
Question by:traport
  • 2
4 Comments
 
LVL 11

Expert Comment

by:Brijesh Chauhan
ID: 35433729
how do you need the list to be ? org1 ,org2 , org3 ??
0
 
LVL 11

Assisted Solution

by:Brijesh Chauhan
Brijesh Chauhan earned 1000 total points
ID: 35433742
you can just use the replace function ...

<cfset testList = 'org1,org2,org3,org4'>
<cfset newList = replace(testList,',',' ,','ALL')>
<cfoutput> #newList#</cfoutput>

Open in new window


if you want the space after the comma, then

<cfset testList = 'org1,org2,org3,org4'>
<cfset newList = replace(testList,',',', ','ALL')>
<cfoutput> #newList#</cfoutput>

Open in new window

0
 
LVL 39

Accepted Solution

by:
gdemaria earned 1000 total points
ID: 35434041

use the listChangeDelims function to change the list from comma delimited to comma + space

#listChangeDelims(form.selectedOrgs,", ")#


0
 

Author Closing Comment

by:traport
ID: 35434975
Both worked perfectly. I went w/ the last one gdemaria - I hadn't heard of the listChange function. Thanks to you both.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Suggested Courses

831 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