tracker issue : CF-3754490

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

Add ability to treat strings like collections

| View in Tracker

Status/Resolution/Reason: To Test//Fixed

Reporter/Name(from Bugbase): Adam Cameron / Adam Cameron (Adam Cameron)

Created: 05/03/2014

Components: Language

Versions: 11.0

Failure Type: Enhancement Request

Found In Build/Fixed In Build: PublicBeta /

Priority/Frequency: Trivial / Unknown

Locale/System: English / Platforms All

Vote Count: 6

On Railo one can do this:

s = "G'day world";
c = s[1];

And it outputs "G".

This is a step in the right direction of being able to treat strings like character arrays. ColdFusion should do this, and it should also add iteration functions which also treat a string like an array of characters, at least .each(), and probably .map(), but there's perhaps a use case for .sort(), .filter(), .reduce(), .some(), .every() too? Perhaps it should be on the basis of "in for a penny, in for a pound", and keep the "interface" to collection iteration functions uniform, even if the use case for some might be marginal?


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

Watson Bug ID:	3754490

External Customer Info:
External Company:  
External Customer Name: Adam Cameron.
External Customer Email:  
External Test Config: My Hardware and Environment details:



We will consider it for the next release.
Comment by Rupesh K.
12372 | May 05, 2014 08:41:22 AM GMT
+1 - (Vote must be between 25 and 4000 characters)
Vote by External U.
12374 | May 06, 2014 12:30:14 AM GMT
Yes, treating strings as arrays in the general case would be _extremely_ useful! And, again, Lucee already supports this.
Vote by External U.
12375 | December 23, 2015 12:11:16 PM GMT
Lucee already supports this, ACF should too.
Vote by External U.
12376 | December 23, 2015 07:38:57 PM GMT
+ 1 for these types of language enhancements!
Vote by External U.
12377 | December 28, 2015 10:10:16 AM GMT
Can you please confirm this has gone into CF2016?
Comment by External U.
12373 | January 25, 2016 08:25:31 AM GMT
Last comment from Adobe six years ago. Nice one.
Comment by Adam C.
33179 | February 25, 2020 01:47:27 PM GMT