Dave Merrill
09/19/2022, 6:19 PMI found a difference in CF2018 from CF9.
ListFind will not find a match in a list where the value starts or ends with a space.
CF9 : ListFind("A, B,C", "B") = true
CF2018 : ListFind("A, B,C", "B") = false
(He doesn't really mean it returns true, just that it found the value in the list.)
I thought listFind would only find exact matches, so leading or trailing spaces in either the find string or the list element that don't match would cause it not to be found, in every version.
I don't have a cf9 server to verify that they used to be ignored.
Does anyone?
Or do you know about a change in this area?joechastain
09/19/2022, 6:32 PMjoechastain
09/19/2022, 6:36 PMjoechastain
09/19/2022, 6:37 PMDave Merrill
09/19/2022, 6:49 PMDave Merrill
09/19/2022, 6:50 PMjoechastain
09/19/2022, 6:51 PMTim
09/19/2022, 7:17 PMListContains
would sort of look like it works that way... but it's because it's looking for a substring inside a list, instead of an item inside a list, not because it's ignoring spaces.Dave Merrill
09/19/2022, 8:40 PMTim
09/19/2022, 8:44 PMListContains("A, B,C", "B")
it returns 2
because it found B
as part of the list item B
, which is the second list item.Tim
09/19/2022, 8:44 PMListContains("A,Banana,C", "B")
would return the same thing.Dave Merrill
09/21/2022, 4:07 PMlistFind("A,B,C", "B")=2
listFind("A, B,C", "B")=0
listFind("A,B ,C", "B")=0
listFind("A,B,C", " B")=0
listFind("A,B,C", "B ")=0Short version is that leading and trailing spaces in both list items and the item being searched for are significant, in that version of CF9. If they don't match, the item won't be found. That's what I expected. Whatever the issue is with the page my coworker was looking at, that isn't it, with the unlikely caveat that this behavior may have changed in a minor version I didn't test.