tracker issue : CF-3318681

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

FindNoCase with a 0 (zero) start position acts unpredictably

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/

Reporter/Name(from Bugbase): Curtis Josey Jr / Curtis Josey Jr (cuCurtis)

Created: 08/27/2012

Components: Language

Versions: 9.0

Failure Type:

Found In Build/Fixed In Build: 9.0 /

Priority/Frequency: Major / Some users will encounter

Locale/System: English / Linux

Vote Count: 0

Problem Description:
Calling this function with a start position of 0 (zero) seems to cause inconsistent behavior (yes, C/F is one based, but for those used to working in Java/C#, it would be nice to trap this condition as an error or behave consistently).  Sample code to reproduce behavior below.

Steps to Reproduce:
<cfoutput>
<cfif FindNoCase(string, '|', 0) GT 0>#Left(string, FindNoCase(string, '|', 0)#<cfelse>#string#</cfif>
</cfoutput>

Actual Result:
It somehow equates to GT 0 in the cfif, but fails in the Left function because it is equal to 0.

Expected Result:
Fail in both statements if the function can't support a start position of 0.

Any Workarounds:
Find colleague to point out that ColdFusion doesn't support 0-based indexes.

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

Watson Bug ID:	3318681

External Customer Info:
External Company:  
External Customer Name: cuCurtis
External Customer Email:  
External Test Config: My Hardware and Environment details:

Attachments:

Comments:

If additional information is needed, please contact me.
Comment by External U.
18284 | August 27, 2012 10:40:17 AM GMT
Please close this bug report ... the problem is actually rooted in the fact that the "Find" functions in ColdFusion have parameters in the reverse order of many common programming languages (i.e., the first argument is typically the variable search in, the second argument is the term to search for ... this is the opposite for ColdFusion for some reason).
Comment by External U.
18285 | August 28, 2012 09:40:05 AM GMT