JString/strpos: Difference between revisions
From Joomla! Documentation
New page: ===Description===
UTF-8 aware alternative to strpos Find position of first occurrence of a string
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JSt... |
m removing red link to edit, no existant pages |
||
| Line 3: | Line 3: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
<nowiki>[< | <nowiki>[<! removed edit link to red link >]</nowiki> | ||
</span> | </span> | ||
<! removed transcluded page call, red link never existed > | |||
===Syntax=== | ===Syntax=== | ||
| Line 51: | Line 51: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
<nowiki>[< | <nowiki>[<! removed edit link to red link >]</nowiki> | ||
</span> | </span> | ||
<! removed transcluded page call, red link never existed > | |||
===Examples=== | ===Examples=== | ||
| Line 66: | Line 66: | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
[[Category:Archived pages API15]] | |||
Revision as of 18:51, 12 May 2013
Description
UTF-8 aware alternative to strpos Find position of first occurrence of a string
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax
strpos($str, $search, $offset=FALSE)
| Parameter Name | Default Value | Description |
|---|---|---|
| $str | - string String being examined | |
| $search | - string String being searced for | |
| $offset | FALSE | - int Optional, specifies the position from which the search should be performed |
Returns
mixed Number of characters before the first match or FALSE on failure
Defined in
libraries/joomla/utilities/string.php
Importing
jimport( 'joomla.utilities.string' );
Source Body
function strpos($str, $search, $offset = FALSE)
{
if ( $offset === FALSE ) {
return utf8_strpos($str, $search);
} else {
return utf8_strpos($str, $search, $offset);
}
}
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples
<CodeExamplesForm />