View comments | RSS feed

Find

Description

Finds the first occurrence of a substring in a string, from a specified start position. The search is case-sensitive.

Return value

A number; the position of substring in string; or 0, if substring is not in string.

Category

String functions

Syntax

Find(substring, string [, start ])

See also

FindNoCase, Compare, FindOneOf, REFind, Replace

Parameters

Parameter Description
substring
A string or a variable that contains one. String for which to search.
string
A string or a variable that contains one. String in which to search.
start
Start position of search.

Example

<cfoutput>
  <cfset stringToSearch = "The quick brown fox jumped over the lazy dog.">
  #find("the",stringToSearch)#<br>
  #find("the",stringToSearch,35)#<br>
  #find("no such substring",stringToSearch)#<br>
  <br>
  #findnocase("the",stringToSearch)#<br>
  #findnocase("the",stringToSearch,5)#<br>
  #findnocase("no such substring",stringToSearch)#<br>
  <br>
  #findoneof("aeiou",stringToSearch)#<br>
  #findoneof("aeiou",stringToSearch,4)#<br>
  #findoneof("@%^*()",stringToSearch)#<br>
</cfoutput>

ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6

Comments are no longer accepted for ColdFusion MX. ColdFusion 8 is the current version.

Comments


John2 said on Nov 26, 2003 at 3:23 AM :
what if I wanted to seach between 2 text positions 35 and 74 for example. surely this should be part for the function

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6/CFML_Reference/functions-pt180.htm