tracker issue : CF-3489021

select a category, or use search below
(searches all categories and all time range)
Title:

Add includeEmptyFields parameter to ReplaceList (as per ListToArray and others)

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Peter Boughton / Peter Boughton (Peter Boughton)

Created: 01/24/2013

Components: Language

Versions: 10.0

Failure Type: Enhancement Request

Found In Build/Fixed In Build: Final / 290471

Priority/Frequency: Major / All users will encounter

Locale/System: English / Platforms All

Vote Count: 2

Listed in the version 11.0.03.292480 Issues Fixed doc
Problem Description:
It is not possible to remove strings using ReplaceList, since empty list elements are ignored.

An extra parameter should be added, as several List~ functions have, to enable empty list elements to be preserved.

For details, see http://stackoverflow.com/questions/14506716/coldfusion-replacelist-reorders-returned-string

Steps to Reproduce:
<cfset Filename = apost's & pound#.JPG />
<cfset NewFilename = replacelist(Filename,"',##,&, ",",,and,-") />

Actual Result:
apostandspound-.JPG

Expected Result:
aposts-and-pound.jpg

Any Workarounds:
<cfset NewFilename = rereplace(Filename,"['##]","","all") />
<cfset NewFilename = replacelist(NewFilename,"&, ","and,-") />

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3489021

External Customer Info:
External Company:  
External Customer Name: boughtonp
External Customer Email:  
External Test Config: CF10

Attachments:

Comments:

http://stackoverflow.com/questions/DVAMC-14506716/coldfusion-replacelist-reorders-returned-string
Vote by External U.
16529 | January 24, 2013 01:31:51 PM GMT
Yeah, it makes no sense for only *most* list functions to support empty elements. This should be done. -- Adam
Vote by External U.
16530 | January 24, 2013 01:34:14 PM GMT
The function call replacelist(Filename,"',##,&, ",",,and,-") will now remove the delimiters ' and # and replace the delimiter & with "and" and spaces with "-" (Comment added from ex-user id:nawani)
Comment by Adobe D.
16526 | September 01, 2014 05:11:34 AM GMT
Hi Anuj, I've verified this is fixed in CF11 Update 3, except for a new bug it created: spaces are no longer replaced. Example: #replaceList("a c", " ", "b")# CF 11 (before Update 3) returns: abc CF11 Update 3 returns: a c Meaning, the function call in your comment doesn't return the expected result in the description (aposts-and-pound.jpg), but rather it returns aposts and pound.jpg. Thanks!, -Aaron
Comment by External U.
16527 | November 05, 2014 05:06:02 AM GMT
Verified this is fixed in CF11 Update 3 (11,0,03,292024(PreRelease)). The example in the description now returns "aposts-and-pound.JPG". Thanks!, -Aaron
Comment by External U.
16528 | November 10, 2014 04:34:46 PM GMT