Scott Bennett
11/18/2022, 7:07 PM<cfscript>
//This works on both
WriteOutput("123".find(2));
//This works in Lucee, but errors in Adobe CF
WriteOutput([1,2,3].find(2));
//In Adobe CF I need to do this to use a member function on an Array
a=[1,2,3];
WriteOutput(a.find(2));
</cfscript>
Scott Bennett
11/18/2022, 7:10 PMTim
11/18/2022, 7:23 PMmtbrown
11/18/2022, 7:25 PMScott Bennett
11/18/2022, 7:28 PMScott Bennett
11/18/2022, 7:28 PMmtbrown
11/18/2022, 7:28 PMScott Bennett
11/18/2022, 7:46 PMMark Takata (Adobe)
11/18/2022, 7:58 PMScott Bennett
11/18/2022, 8:02 PMfunction OrdinalFormat(n) {
return n&=arrayfind([1,2,3],n%10)&&!arrayfind([11,12,13],n%100)?listgetat('st,nd,rd',n%10):'th';
}
Or on lucee:
function OrdinalFormat(n) {
return n&=[1,2,3].find(n%10)&&![11,12,13].find(n%100)?['st','nd','rd'][n%10]:'th';
}
@Mark Takata (Adobe) is there a bug tracker ticket for the modifying the bug tracker so that comments are editable and my mistake is not there for everyone to see for all time? lolmtbrown
11/18/2022, 8:05 PMScott Bennett
11/18/2022, 8:06 PMMark Takata (Adobe)
11/18/2022, 9:54 PMScott Bennett
11/18/2022, 9:55 PMmtbrown
11/18/2022, 9:55 PMScott Bennett
11/18/2022, 9:56 PM