mirror of
https://github.com/processing/processing4.git
synced 2026-02-12 18:10:43 +01:00
55 lines
1.1 KiB
XML
55 lines
1.1 KiB
XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
<root>
|
|
|
|
<name>indexOf()</name>
|
|
|
|
<category>String</category>
|
|
|
|
<subcategory>Method</subcategory>
|
|
|
|
<usage>Web & Application</usage>
|
|
|
|
<example>
|
|
<image></image>
|
|
<code>
|
|
String str = "CCCP";
|
|
int p1 = str.indexOf("C");
|
|
int p2 = str.indexOf("P");
|
|
int p3 = str.indexOf("CP");
|
|
println(p1 + ":" + p2 + ":" + p3); // Prints '0:3:2'
|
|
</code>
|
|
</example>
|
|
|
|
<description>
|
|
Tests to see if a substring is embedded in a string and returns the index position of the first occurance of the substring defined in the <b>str</b> parameter. If the <b>str</b> parameter is not found in the string, -1 is returned.
|
|
</description>
|
|
|
|
<syntax>
|
|
indexOf(<c>str</c>)
|
|
indexOf(<c>str</c>, <c>fromIndex</c>)
|
|
</syntax>
|
|
|
|
<parameter>
|
|
<label>str</label>
|
|
<description>String: the substring to search</description>
|
|
</parameter>
|
|
|
|
<parameter>
|
|
<label>fromIndex</label>
|
|
<description>int: the index from which to start the search</description>
|
|
</parameter>
|
|
|
|
<returns>int</returns>
|
|
|
|
<related>
|
|
</related>
|
|
|
|
<availability>1.0</availability>
|
|
|
|
<type>Method</type>
|
|
|
|
<partof>Core</partof>
|
|
|
|
|
|
</root>
|