API15

JString/strspn

From Joomla! Documentation

< API15:JString

The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

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

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax[edit]

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[edit]

libraries/joomla/utilities/string.php

Importing[edit]

jimport( 'joomla.utilities.string' );

Source Body[edit]

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

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples[edit]

Code Examples[edit]