JString/strcspn: Difference between revisions
From Joomla! Documentation
New page: ===Description===
UTF-8 aware alternative to strcspn Find length of initial segment not matching mask
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description... |
m preparing for archive only |
||
| (One intermediate revision by the same user not shown) | |||
| Line 3: | Line 3: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
<nowiki>[< | <nowiki>[<! removed edit link to red link >]</nowiki> | ||
</span> | </span> | ||
<! removed transcluded page call, red link never existed > | |||
===Syntax=== | ===Syntax=== | ||
| Line 58: | Line 58: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
<nowiki>[< | <nowiki>[<! removed edit link to red link >]</nowiki> | ||
</span> | </span> | ||
<! removed transcluded page call, red link never existed > | |||
===Examples=== | ===Examples=== | ||
=== Code Examples === | |||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=strcspn | category=strcspn | ||
category=JString | category=JString | ||
namespace=CodeExample | |||
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
[[Category:Archived pages API15]] | |||
Latest revision as of 01:09, 25 March 2017
Description
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
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
int the length of the initial segment of str1 which does not contain any of the characters in str2
Defined in
libraries/joomla/utilities/string.php
Importing
jimport( 'joomla.utilities.string' );
Source Body
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
Code Examples