API15

JString/strcspn

From Joomla! Documentation

< API15:JString
Revision as of 13:50, 12 May 2013 by JoomlaWikiBot (talk | contribs) (removing red link to edit, no existant pages)

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 strcspn Find length of initial segment not matching mask

[<! removed edit link to red link >]

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

Syntax[edit]

strcspn($str, $mask, $start=NULL, $length=NULL)
Parameter Name Default Value Description
$str
$mask the mask
$start NULL Optional starting character position (in characters)
$length NULL Optional length

Returns[edit]

int the length of the initial segment of str1 which does not contain any of the characters in str2

Defined in[edit]

libraries/joomla/utilities/string.php

Importing[edit]

jimport( 'joomla.utilities.string' );

Source Body[edit]

function strcspn($str, $mask, $start = NULL, $length = NULL)
{
        jimport('phputf8.strcspn');
        if ( $start === FALSE && $length === FALSE ) {
                return utf8_strcspn($str, $mask);
        } else if ( $length === FALSE ) {
                return utf8_strcspn($str, $mask, $start);
        } else {
                return utf8_strcspn($str, $mask, $start, $length);
        }
}

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

Examples[edit]

<CodeExamplesForm />