API16

JString/strspn: Difference between revisions

From Joomla! Documentation

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...
 
m clean up
Line 2: Line 2:
UTF-8 aware alternative to strspn Find length of initial segment matching mask
UTF-8 aware alternative to strspn Find length of initial segment matching mask


<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JString/strspn|Edit Descripton]]<nowiki>]</nowiki>
</span>


{{Description:JString/strspn}}
 
{{subst:Description:JString/strspn}}


===Syntax===
===Syntax===
Line 54: Line 52:
</source>
</source>


<span class="editsection" style="font-size:76%;">
 
<nowiki>[</nowiki>[[SeeAlso:JString/strspn|Edit See Also]]<nowiki>]</nowiki>
{{subst:SeeAlso:JString/strspn}}
</span>
{{SeeAlso:JString/strspn}}


===Examples===
===Examples===

Revision as of 14:28, 24 March 2017

Description

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


{{subst: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);
        }
}


{{subst:SeeAlso:JString/strspn}}

Examples

<CodeExamplesForm />