API15

API15:JString/strpos

From Joomla! Documentation

Revision as of 22:25, 22 March 2010 by Doxiki (talk | contribs) (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...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Description

UTF-8 aware alternative to strpos Find position of first occurrence of a string

[Edit Descripton]

Template:Description:JString/strpos

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);
        }
}

[Edit See Also] Template:SeeAlso:JString/strpos

Examples

<CodeExamplesForm />