tracker issue : CF-3712186

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

Many string member functions not implemented

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

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

Created: 02/23/2014

Components: Language

Versions: 11.0

Failure Type: Non Functioning

Found In Build/Fixed In Build: PublicBeta /

Priority/Frequency: Major / Some users will encounter

Locale/System: English / Platforms All

Vote Count: 2


The following string member functions (and other similar ones) have not been implemented:

encodeForUrl() (and I presume the other encoding functions)
htmlEditFormat() (and probably htmlCodeFormat())
isDate() (and I presume other type-checking functions)
LSParseEuroCurrency() (and there'll be a few other locale-specific ones that deal with strings; these should be dealt with too)
reFind() (and I presume the no-case version. Although I question whether separate methods just to handle case-sensitivity is sensible. This can be done with the regex itself after all)
reMatch() (as above)
repeatString() (this should just be implemented as repeat(). It's tautological to include "string" in a string method)

Raising as a BUG because the work done should be more complete than it has been.


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

Watson Bug ID:	3712186

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



+1 I was especially hoping the regex functions would be available in this case.
Vote by External U.
13290 | February 23, 2014 10:42:19 PM GMT
+1 I Agree. This should not become another cfscript support situation where we don't get full member function support until several versions after this.
Vote by External U.
13291 | February 24, 2014 12:25:22 PM GMT
I note this has been marked "to fix". Can you pls list the functions you intend to add, and any you're not so sure about. Also note: my list above is not necessarily exhaustive. -- Adam
Comment by External U.
13272 | February 25, 2014 05:21:57 AM GMT
Added following functions Decrypt Encrypt BinaryDecode BinaryEncode CharsetDecode CharsetEncode URLDecode URLEncodedFormat HTMLEditFormat HTMLCodeFormat ParagraphFormat JSStringFormat XmlFormat FormatBaseN HTMLEditFormat HTMLCodeFormat ParagraphFormat ToBinary ToString ToBase64 Val GenerateSecretKey Hash REFind N REFindNoCase N REMatch N REMatchNoCase N REReplace REReplaceNoCase ReplaceList SpanExcluding SpanIncluding LSParseEuroCurrency LSParseDateTime LSIsCurrency LSIsDate LSIsNumeric LSParseCurrency LSParseNumber ParseDateTime
Comment by Awdhesh K.
13273 | February 27, 2014 02:26:41 AM GMT
Are there any that you DIDN'T implement, and is there are rationale as to why? What about other datatypes? Did you assess them for any functions you had not covered? It seems unlikely that you missed so many string functions but no functions for other types. Can you pls explain why you implemented a toString() method on the String class? -- Adam
Comment by External U.
13274 | February 27, 2014 01:18:39 PM GMT
Its not a bounced case.. Can you please a separate bug for this.
Comment by Awdhesh K.
13275 | March 06, 2014 11:38:48 PM GMT
Hi, can I get some response to my questions? -- Adam
Comment by External U.
13276 | March 07, 2014 01:04:47 AM GMT
Hello? -- Adam
Comment by External U.
13277 | April 30, 2014 07:23:31 AM GMT
There are some functions which can be argued either way whether to consider them to be string function. As of now, we have considered String functions listed at We have not implemented toString() for string. toString() and hashcode() etc would come from Java. As you know ColdFusion string is actually Java string and therefore all the java .lang.String methods are also available naturally.
Comment by Rupesh K.
13278 | April 30, 2014 07:42:19 AM GMT
I think this needs reopening as you've done a sloppy job here. The first thing you should have done before implementing the fix based on that list of string functions is to check whether that list is complete. Which it isn't, so you've missed a bunch of string method implementations. Specifically I've just been undone by encodeForHtml() not having been done. You guys need to lift your game when it comes to doing your job thoroughly. How did this get all the way through planning, dev, testing, QA without this being noticed? It's just slack. -- Adam
Comment by External U.
13279 | February 15, 2015 10:37:43 PM GMT
Hi Adam, I just emailed Jacob about the canonicalize() and encodeFor__() docs. On each of those pages, their category (which is listed as "Display and formatting functions") is unclickable. Additionally, they are not listed under that category, nor are they listed under string functions as you've mentioned. Also, I ran the code from your blog entry to check which of the functions from the description were done and which weren't. Result: Done: decrypt() deserializeJson() encrypt() hash() htmlEditFormat() javaCast() jsStringFormat() listValueCount() LSParseEuroCurrency() parseDateTime() reFind() reMatch() repeatString() replaceList() reReplace() toBase64() urlDecode() urlEncodedFormat() val() xmlFormat() Not done: canonicalize() encodeForUrl() isDate() isNumeric() isValid() javaCast() numberFormat() reEscape() serializeJson() xmlParse() Thanks!, -Aaron P.S. Adobe, this ticket isn't completely fixed. And please don't forget the EncodeFor__() ones.
Comment by External U.
13280 | December 01, 2015 11:56:40 PM GMT
I see string.toBase64() works but binary.toBase64() doesn't. :/ Looks like tickets need created for each data type. Thanks!, -Aaron
Comment by External U.
13281 | December 02, 2015 12:30:57 AM GMT
Hi Rupesh, If you read Adwesh's comment, you will see why Adam was asking him why he added .toString(). B/c Adwesh said: "Added following functions [....] ToString". Thanks!, -Aaron
Comment by External U.
13282 | December 02, 2015 12:50:15 AM GMT
Of the additional ones Adwesh added (referring to comment on "11:56:41 PM GMT+00:00 Feb 26, 2014"), I've verified these are done: BinaryDecode, CharsetDecode, Hash, LSIsDate, LSIsNumeric, LSParseCurrency, LSParseDateTime, LSParseNumber, ParagraphFormat, REReplaceNoCase, SpanExcluding, SpanIncluding, ToBinary and ToString. These others he listed, however, are not done: BinaryEncode, CharsetEncode, FormatBaseN and GenerateSecretKey. That last one GenerateSecretKey doesn't even make sense as a string member function so nothing should be done there. But the 1st 3 should be done. Can this ticket also please be re-opened to add: .binaryEncode(), .charsetEncode() and .formatBaseN()? Thanks!, -Aaron P.S. Verified using the following code (added to Adam's code from his blog): writeOutput("<hr><h3>toBase64()</h3>"); writeDump(var=safeCall(function(){ return textString.toBase64(); })); writeOutput("<hr><h3>binaryDecode()</h3>"); writeDump(var=safeCall(function(){ var binary = fileReadBinary(expandPath('./' & getFileFromPath(getCurrentTemplatePath()))); var base64 = toBase64(binary); return base64.binaryDecode("base64"); })); writeOutput("<hr><h3>binaryEncode()</h3>"); writeDump(var=safeCall(function(){ var binary = fileReadBinary(expandPath('./' & getFileFromPath(getCurrentTemplatePath()))); return binary.binaryEncode("base64"); })); writeOutput("<hr><h3>charsetDecode()</h3>"); writeDump(var=safeCall(function(){ return textString.charsetDecode("utf-8"); })); writeOutput("<hr><h3>charsetEncode()</h3>"); writeDump(var=safeCall(function(){ var binary = textString.charsetDecode("utf-8"); return binary.charsetEncode("utf-8"); })); writeOutput("<hr><h3>paragraphFormat()</h3>"); writeDump(var=safeCall(function(){ return textString.paragraphFormat(); })); writeOutput("<hr><h3>formatBaseN()</h3>"); writeDump(var=safeCall(function(){ return numericString.formatBaseN(10); })); writeOutput("<hr><h3>toBinary()</h3>"); writeDump(var=safeCall(function(){ var binary = fileReadBinary(expandPath('./' & getFileFromPath(getCurrentTemplatePath()))); var base64 = toBase64(binary); return base64.toBinary(); })); writeOutput("<hr><h3>toString()</h3>"); writeDump(var=safeCall(function(){ return textString.toString(); })); writeOutput("<hr><h3>generateSecretKey()</h3>"); writeDump(var=safeCall(function(){ return textString.generateSecretKey("aes");//doesn't even make sense as member function })); writeOutput("<hr><h3>hash()</h3>"); writeDump(var=safeCall(function(){ return textString.hash("CFMX_COMPAT"); })); writeOutput("<hr><h3>reReplaceNoCase()</h3>"); writeDump(var=safeCall(function(){ return textString.reReplaceNoCase("world", "universe"); })); writeOutput("<hr><h3>spanExcluding()</h3>"); writeDump(var=safeCall(function(){ return textString.spanExcluding("d"); })); writeOutput("<hr><h3>spanIncluding()</h3>"); writeDump(var=safeCall(function(){ return textString.spanIncluding("G'y"); })); writeOutput("<hr><h3>lsParseDateTime()</h3>"); writeDump(var=safeCall(function(){ return dateString.lsParseDateTime(); })); writeOutput("<hr><h3>lsIsCurrency()</h3>"); writeDump(var=safeCall(function(){ var currencyString = "€1.000,00"; var locale = "DE_DE"; return currencyString.lsIsCurrency(locale); })); writeOutput("<hr><h3>lsIsDate()</h3>"); writeDump(var=safeCall(function(){ return dateString.lsIsDate("DE_DE"); })); writeOutput("<hr><h3>lsIsNumeric()</h3>"); writeDump(var=safeCall(function(){ return numericString.lsIsNumeric("DE_DE"); })); writeOutput("<hr><h3>lsParseCurrency()</h3>"); writeDump(var=safeCall(function(){ var currencyString = "€1.000,00"; return currencyString.lsParseCurrency("DE_DE"); })); writeOutput("<hr><h3>lsParseNumber()</h3>"); writeDump(var=safeCall(function(){ var numberString = "1.000,00"; return numberString.lsParseNumber("DE_DE"); }));
Comment by External U.
13283 | December 02, 2015 01:35:50 AM GMT
> If you read Adwesh's comment, you will see why Adam was asking him why he added .toString(). B/c Adwesh said: "Added following functions [....] ToString". Indeed. But sounds like Awdhesh just spoke inaccurately. However it's also listed in the docs:, so I do wonder who's got the wrong end of the stick here.
Comment by External U.
13284 | December 02, 2015 02:46:39 AM GMT
BinaryEncode, CharsetEncode and FormatBaseN can't be a string member function as they dont work on String. BinaryEncode and CharsetEncode takes binary data and FormatBaseN works on integer. There is nothing more to be done here.
Comment by Rupesh K.
13285 | December 10, 2015 11:31:34 PM GMT
Hi Rupesh, Ah, yes, you're right regarding BinaryEncode, CharsetEncode and FormatBaseN. I was just iterating over Awdhesh's list in his comment on 11:56:41 PM GMT+00:00 Feb 26, 2014. However, the following aren't done and should be: canonicalize() encodeForUrl() isDate() isNumeric() isValid() javaCast() numberFormat() reEscape() serializeJson() xmlParse() Please see my comment on 9:26:40 PM GMT+00:00 Dec 1, 2015. To verify, just run the code from Adam's blog post (URL in ticket description). Thanks!, -Aaron
Comment by External U.
13286 | December 11, 2015 04:56:00 AM GMT
Whilst there should be member functions for all those, I'm not sure they should all intrinsically be member functions of the *string* class. See my blog article about the encoding ones, here:
Comment by External U.
13287 | December 11, 2015 05:00:24 AM GMT
Hi Adam, I did +1 that ticket. It looks like those remaining member functions from my previous comment probably won't get added for a while.. Those functions were actually listed in the description, and they *still* Closed/Fixed this ticket w/o implementing them. Makes me want to add: *boggle* =) Thanks!, -Aaron
Comment by External U.
13288 | December 15, 2015 05:47:54 AM GMT
Hi Rupesh, Regarding "As of now, we have considered String functions listed at" Issues: 1) This ticket covers canonicalize() and encodeFor*(). Those are listed on that string functions page. Those should be implemented as part of this ticket. 2) This ticket covers isDate() and isNumeric(). That string functions page lists LSIsDate() and LSIsNumeric(). So that string functions page should list isDate() and isNumeric(). And all 4 of these should be implemented as part of this ticket. 3) This ticket covers xmlFormat(). That string functions page lists xmlFormat(). So that should be implemented as part of this ticket. 4) This ticket covers xmlParse(). That converts an XML -string- to an XML object. It should be implemented as part of this ticket. 5) This ticket covers isValid(). Many of isValid()'s validations are for strings. It should be implemented as part of this ticket for any of its validations that work on simple values. 6) This ticket covers reEscape(). Again, that works on strings. It should be implemented as part of this ticket. 7) This ticket covers serializeJSON(). It can also work on strings - so why isn't it implemented? 8) This ticket covers numberFormat(). Numbers are stored as strings, not double. So shouldn't it also be implemented? Thanks!, -Aaron
Comment by External U.
13289 | January 05, 2016 01:54:24 AM GMT