Solved

Add a space after commas in a coldfusion string

Posted on 2013-01-17
2
684 Views
Last Modified: 2013-01-17
I have a select box that allows the user to choose multiple choices and then my cfoutput code writes this to the page. It outputs the choices separated by a comma but no space after the comma. The choice with multiples is "usernames". Right now they show as: username1,username2,username3 etc... I'd like: username1, username2, username3 etc..

I'd like to add a space after each comma. Thank you.

<cfoutput><p>User Names: #usernames#  Range: #StDate# - #EdDate#</p></cfoutput>

Open in new window

0
Comment
Question by:earwig75
2 Comments
 
LVL 13

Expert Comment

by:ansudhindra
ID: 38788607
use can use replace function

like
<cfset updatedString = replace(usernames,",",", ","All") />
0
 
LVL 39

Accepted Solution

by:
gdemaria earned 500 total points
ID: 38788729
listChangeDelims(usernames,", ")

note there is a space in the quotes:  ",_"   where _ is the space
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

914 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now