Find()
Finds the first occurrence of a substring in a string, from a specified start position.
The search is case-sensitive.
Find( substring=string, string=string, start=number );
Returns: Number
Argument | Description | Default |
---|---|---|
substring
string,
required
|
String for which to search. |
|
string
string,
required
|
String in which to search. |
|
start
number,
optional
|
Start position of search. |
1 |
Examples
writeOutput(find("tree","Grow the tree, Save the world"));//10
<span class="c">//Member function</span>
<span class="nv">str</span><span class="o">=</span><span class="s2">"I love lucee"</span><span class="p">;</span>
<span class="nf">writeOutput</span><span class="p">(</span><span class="nf">str.find</span><span class="p">(</span><span class="s1">'lucee'</span><span class="p">));</span><span class="c">//8</span>
See also
- Strings
- string.find()
- Search Issue Tracker
- Search Lucee Test Cases (good for further, detailed examples)