Find(substring, string [, start ])

Description

Returns the first index of an occurrence of a substring in a string from a specified starting position. Returns 0 if substring is not in string. The search is case-sensitive.

Category

String functions

See also

FindNoCase, Compare, FindOneOf, REFind, Replace

Parameters

Parameter
Description
substring
String sought
string
String to search
start
Starting position for the search

Example

...
<!--- depending upon the action desired, perform
different function --->
<cfswitch expression = "#tag#">
    <cfcase value = "find">
        <cfset TheAction = Find(FORM.MyString,
         CFHTTP.FileContent, 1)>
    </cfcase>
    <cfcase value = "findNoCase">
        <cfset TheAction = FindNoCase(FORM.MyString,
         CFHTTP.FileContent, 1)>
    </cfcase>    
    <cfcase value = "findOneof">
        <cfset TheAction = FindOneOf(FORM.MyString,
         CFHTTP.FileContent, 1)>
    </cfcase>    
    <CFDEFAULTCASE>
        <cfset TheAction = Find(FORM.MyString,
         CFHTTP.FileContent, 1)>
    </CFDEFAULTCASE>
</cfswitch>
...