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

x
?
Solved

Add a space after commas in a coldfusion string

Posted on 2013-01-17
2
Medium Priority
?
809 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
[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 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 2000 total points
ID: 38788729
listChangeDelims(usernames,", ")

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

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

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 …
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

636 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