• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 851
  • Last Modified:

Add a space after commas in a coldfusion string

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

1 Solution
use can use replace function

<cfset updatedString = replace(usernames,",",", ","All") />
listChangeDelims(usernames,", ")

note there is a space in the quotes:  ",_"   where _ is the space
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now