API16

API16:JString/strspn

From Joomla! Documentation

Revision as of 22:48, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description=== UTF-8 aware alternative to strspn Find length of initial segment matching mask <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>[[Description:JStr...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Description

UTF-8 aware alternative to strspn Find length of initial segment matching mask

[Edit Descripton]

Template:Description:JString/strspn

Syntax

static strspn($str, $mask, $start=NULL, $length=NULL)
Parameter Name Default Value Description
$str the haystack
$mask the mask
$start NULL start optional
$length NULL length optional

Defined in

libraries/joomla/utilities/string.php

Importing

jimport( 'joomla.utilities.string' );

Source Body

public static function strspn($str, $mask, $start = NULL, $length = NULL)
{
        jimport('phputf8.strspn');
        if ( $start === FALSE && $length === FALSE ) {
                return utf8_strspn($str, $mask);
        } else if ( $length === FALSE ) {
                return utf8_strspn($str, $mask, $start);
        } else {
                return utf8_strspn($str, $mask, $start, $length);
        }
}

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

Examples

<CodeExamplesForm />