Actions

API15

JString/strpos

From Joomla! Documentation

< API15:JString
Revision as of 17:25, 22 March 2010 by Doxiki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

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

[Edit Descripton]

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] SeeAlso:JString/strpos

Examples

<CodeExamplesForm />