Actions

API17

Difference between revisions of "JString"

From Joomla! Documentation

(Layout updates)
m (User contributed notes: bad link repair)
(One intermediate revision by one user not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 +
=={{JVer|11.1}} JString==
 +
===Description===
 +
{{Description:JString}}
 
<span class="editsection" style="font-size:76%;">
 
<span class="editsection" style="font-size:76%;">
 
<nowiki>[</nowiki>[[Description:JString|Edit Descripton]]<nowiki>]</nowiki>
 
<nowiki>[</nowiki>[[Description:JString|Edit Descripton]]<nowiki>]</nowiki>
 
</span>
 
</span>
{{Description:JString}}
 
===Defined in===
 
libraries/joomla/utilities/string.php
 
* see source code in [[jplatform:utilities/string.php|BitBucket]]
 
===Subpackage===
 
[[Subpackage Utilities/11.1|Utilities]]
 
===Extends===
 
===Extended by===
 
 
===Methods===
 
===Methods===
 
{| class="wikitable sortable"
 
{| class="wikitable sortable"
 
|-
 
|-
 +
!Visibility
 
!Method name
 
!Method name
 
!Description
 
!Description
 
|-
 
|-
 +
|public static
 
|[[JString::compliant/11.1|compliant]]
 
|[[JString::compliant/11.1|compliant]]
 
|Tests whether a string complies as UTF-8.  
 
|Tests whether a string complies as UTF-8.  
 
|-
 
|-
 +
|public static
 
|[[JString::ltrim/11.1|ltrim]]
 
|[[JString::ltrim/11.1|ltrim]]
 
|UTF-8 aware replacement for  Strip whitespace (or other characters) from the beginning of a string Note: you only need to use this if you are supplying the charlist optional arg and it contains UTF-8 characters.  
 
|UTF-8 aware replacement for  Strip whitespace (or other characters) from the beginning of a string Note: you only need to use this if you are supplying the charlist optional arg and it contains UTF-8 characters.  
 
|-
 
|-
 +
|public static
 
|[[JString::parse_url/11.1|parse_url]]
 
|[[JString::parse_url/11.1|parse_url]]
 
|Does a UTF-8 safe version of PHP parse_url function.  
 
|Does a UTF-8 safe version of PHP parse_url function.  
 
|-
 
|-
 +
|public static
 
|[[JString::rtrim/11.1|rtrim]]
 
|[[JString::rtrim/11.1|rtrim]]
 
|UTF-8 aware replacement for  Strip whitespace (or other characters) from the end of a string Note: you only need to use this if you are supplying the charlist optional arg and it contains UTF-8 characters.  
 
|UTF-8 aware replacement for  Strip whitespace (or other characters) from the end of a string Note: you only need to use this if you are supplying the charlist optional arg and it contains UTF-8 characters.  
 
|-
 
|-
 +
|public static
 
|[[JString::str_ireplace/11.1|str_ireplace]]
 
|[[JString::str_ireplace/11.1|str_ireplace]]
 
|UTF-8 aware alternative to str_ireplace Case-insensitive version of str_replace.  
 
|UTF-8 aware alternative to str_ireplace Case-insensitive version of str_replace.  
 
|-
 
|-
 +
|public static
 
|[[JString::str_split/11.1|str_split]]
 
|[[JString::str_split/11.1|str_split]]
 
|UTF-8 aware alternative to str_split Convert a string to an array.  
 
|UTF-8 aware alternative to str_split Convert a string to an array.  
 
|-
 
|-
 +
|public static
 
|[[JString::strcasecmp/11.1|strcasecmp]]
 
|[[JString::strcasecmp/11.1|strcasecmp]]
 
|UTF-8/LOCALE aware alternative to strcasecmp A case insensivite string comparison.  
 
|UTF-8/LOCALE aware alternative to strcasecmp A case insensivite string comparison.  
 
|-
 
|-
 +
|public static
 
|[[JString::strcmp/11.1|strcmp]]
 
|[[JString::strcmp/11.1|strcmp]]
|UTF-8/LOCALE aware alternative to strcmp A case sensivite string comparison.  
+
|UTF-8/LOCALE aware alternative to strcmp A case sensitive string comparison.  
 
|-
 
|-
 +
|public static
 
|[[JString::strcspn/11.1|strcspn]]
 
|[[JString::strcspn/11.1|strcspn]]
 
|UTF-8 aware alternative to strcspn Find length of initial segment not matching mask.  
 
|UTF-8 aware alternative to strcspn Find length of initial segment not matching mask.  
 
|-
 
|-
 +
|public static
 
|[[JString::stristr/11.1|stristr]]
 
|[[JString::stristr/11.1|stristr]]
 
|UTF-8 aware alternative to stristr Returns all of haystack from the first occurrence of needle to the end.  
 
|UTF-8 aware alternative to stristr Returns all of haystack from the first occurrence of needle to the end.  
 
|-
 
|-
 +
|public static
 
|[[JString::strlen/11.1|strlen]]
 
|[[JString::strlen/11.1|strlen]]
 
|UTF-8 aware alternative to strlen Returns the number of characters in the string (NOT THE NUMBER OF BYTES),.  
 
|UTF-8 aware alternative to strlen Returns the number of characters in the string (NOT THE NUMBER OF BYTES),.  
 
|-
 
|-
 +
|public static
 
|[[JString::strpos/11.1|strpos]]
 
|[[JString::strpos/11.1|strpos]]
 
|UTF-8 aware alternative to strpos Find position of first occurrence of a string.  
 
|UTF-8 aware alternative to strpos Find position of first occurrence of a string.  
 
|-
 
|-
 +
|public static
 
|[[JString::strrev/11.1|strrev]]
 
|[[JString::strrev/11.1|strrev]]
 
|UTF-8 aware alternative to strrev Reverse a string.  
 
|UTF-8 aware alternative to strrev Reverse a string.  
 
|-
 
|-
 +
|public static
 
|[[JString::strrpos/11.1|strrpos]]
 
|[[JString::strrpos/11.1|strrpos]]
 
|UTF-8 aware alternative to strrpos Finds position of last occurrence of a string.  
 
|UTF-8 aware alternative to strrpos Finds position of last occurrence of a string.  
 
|-
 
|-
 +
|public static
 
|[[JString::strspn/11.1|strspn]]
 
|[[JString::strspn/11.1|strspn]]
 
|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.  
 
|-
 
|-
 +
|public static
 
|[[JString::strtolower/11.1|strtolower]]
 
|[[JString::strtolower/11.1|strtolower]]
 
|UTF-8 aware alternative to strtlower Make a string lowercase Note: The concept of a characters "case" only exists is some alphabets such as Latin, Greek, Cyrillic, Armenian and archaic Georgian - it does not exist in the Chinese alphabet, for example.  
 
|UTF-8 aware alternative to strtlower Make a string lowercase Note: The concept of a characters "case" only exists is some alphabets such as Latin, Greek, Cyrillic, Armenian and archaic Georgian - it does not exist in the Chinese alphabet, for example.  
 
|-
 
|-
 +
|public static
 
|[[JString::strtoupper/11.1|strtoupper]]
 
|[[JString::strtoupper/11.1|strtoupper]]
 
|UTF-8 aware alternative to strtoupper Make a string uppercase Note: The concept of a characters "case" only exists is some alphabets such as Latin, Greek, Cyrillic, Armenian and archaic Georgian - it does not exist in the Chinese alphabet, for example.  
 
|UTF-8 aware alternative to strtoupper Make a string uppercase Note: The concept of a characters "case" only exists is some alphabets such as Latin, Greek, Cyrillic, Armenian and archaic Georgian - it does not exist in the Chinese alphabet, for example.  
 
|-
 
|-
 +
|public static
 
|[[JString::substr/11.1|substr]]
 
|[[JString::substr/11.1|substr]]
 
|UTF-8 aware alternative to substr Return part of a string given character offset (and optionally length).  
 
|UTF-8 aware alternative to substr Return part of a string given character offset (and optionally length).  
 
|-
 
|-
 +
|public static
 
|[[JString::substr_replace/11.1|substr_replace]]
 
|[[JString::substr_replace/11.1|substr_replace]]
 
|UTF-8 aware substr_replace Replace text within a portion of a string.  
 
|UTF-8 aware substr_replace Replace text within a portion of a string.  
 
|-
 
|-
 +
|public static
 
|[[JString::transcode/11.1|transcode]]
 
|[[JString::transcode/11.1|transcode]]
 
|Transcode a string.  
 
|Transcode a string.  
 
|-
 
|-
 +
|public static
 
|[[JString::trim/11.1|trim]]
 
|[[JString::trim/11.1|trim]]
 
|UTF-8 aware replacement for  Strip whitespace (or other characters) from the beginning and end of a string Note: you only need to use this if you are supplying the charlist optional arg and it contains UTF-8 characters.  
 
|UTF-8 aware replacement for  Strip whitespace (or other characters) from the beginning and end of a string Note: you only need to use this if you are supplying the charlist optional arg and it contains UTF-8 characters.  
 
|-
 
|-
 +
|public static
 
|[[JString::ucfirst/11.1|ucfirst]]
 
|[[JString::ucfirst/11.1|ucfirst]]
 
|UTF-8 aware alternative to ucfirst Make a string's first character uppercase.  
 
|UTF-8 aware alternative to ucfirst Make a string's first character uppercase.  
 
|-
 
|-
 +
|public static
 
|[[JString::ucwords/11.1|ucwords]]
 
|[[JString::ucwords/11.1|ucwords]]
 
|UTF-8 aware alternative to ucwords Uppercase the first character of each word in a string.  
 
|UTF-8 aware alternative to ucwords Uppercase the first character of each word in a string.  
 
|-
 
|-
 +
|public static
 
|[[JString::valid/11.1|valid]]
 
|[[JString::valid/11.1|valid]]
 
|Tests a string as to whether it's valid UTF-8 and supported by the Unicode standard Note: this function has been modified to simple return true or false.  
 
|Tests a string as to whether it's valid UTF-8 and supported by the Unicode standard Note: this function has been modified to simple return true or false.  
 
|-
 
|-
 
|}
 
|}
 +
* '''Defined in''' libraries/joomla/utilities/string.php
 
===Importing===
 
===Importing===
 
<source lang="php">jimport( 'joomla.utilities.string' );</source>
 
<source lang="php">jimport( 'joomla.utilities.string' );</source>
 
===See also===
 
===See also===
* JString source code in [[jplatform:utilities/string.php|BitBucket]]
+
* {{JVer|11.1}} '''JString source code''' on [[jplatform:utilities/string.php|BitBucket]]
* [[JString|Other versions of this class]]
+
* {{JVer|11.1}} Subpackage [[Subpackage Utilities/11.1|Utilities]]
 +
* [[JString|Other versions of JString]]
 
{{SeeAlso:JString}}
 
{{SeeAlso:JString}}
 
<span class="editsection" style="font-size:76%;">
 
<span class="editsection" style="font-size:76%;">
 
<nowiki>[</nowiki>[[SeeAlso:JString|Edit See Also]]<nowiki>]</nowiki>
 
<nowiki>[</nowiki>[[SeeAlso:JString|Edit See Also]]<nowiki>]</nowiki>
 
</span>
 
</span>
===Examples===
+
===User contributed notes===
 
<CodeExamplesForm />
 
<CodeExamplesForm />
 
<dpl>
 
<dpl>
Line 107: Line 129:
 
category=ClassExample
 
category=ClassExample
 
include=*
 
include=*
 +
namespace=CodeExample
 
format= ,,,
 
format= ,,,
 
</dpl>
 
</dpl>
<noinclude>[[Category:Platform]][[Category:Platform 11.1]][[Category:JString]]</noinclude>
+
<noinclude>[[Category:Platform JClasses]][[Category:Platform 11.1]][[Category:JString]]</noinclude>

Revision as of 14:03, 29 August 2012

Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Joomla 11.1 JString

Description

Description:JString [Edit Descripton]

Methods

Visibility Method name Description
public static compliant Tests whether a string complies as UTF-8.
public static ltrim UTF-8 aware replacement for Strip whitespace (or other characters) from the beginning of a string Note: you only need to use this if you are supplying the charlist optional arg and it contains UTF-8 characters.
public static parse_url Does a UTF-8 safe version of PHP parse_url function.
public static rtrim UTF-8 aware replacement for Strip whitespace (or other characters) from the end of a string Note: you only need to use this if you are supplying the charlist optional arg and it contains UTF-8 characters.
public static str_ireplace UTF-8 aware alternative to str_ireplace Case-insensitive version of str_replace.
public static str_split UTF-8 aware alternative to str_split Convert a string to an array.
public static strcasecmp UTF-8/LOCALE aware alternative to strcasecmp A case insensivite string comparison.
public static strcmp UTF-8/LOCALE aware alternative to strcmp A case sensitive string comparison.
public static strcspn UTF-8 aware alternative to strcspn Find length of initial segment not matching mask.
public static stristr UTF-8 aware alternative to stristr Returns all of haystack from the first occurrence of needle to the end.
public static strlen UTF-8 aware alternative to strlen Returns the number of characters in the string (NOT THE NUMBER OF BYTES),.
public static strpos UTF-8 aware alternative to strpos Find position of first occurrence of a string.
public static strrev UTF-8 aware alternative to strrev Reverse a string.
public static strrpos UTF-8 aware alternative to strrpos Finds position of last occurrence of a string.
public static strspn UTF-8 aware alternative to strspn Find length of initial segment matching mask.
public static strtolower UTF-8 aware alternative to strtlower Make a string lowercase Note: The concept of a characters "case" only exists is some alphabets such as Latin, Greek, Cyrillic, Armenian and archaic Georgian - it does not exist in the Chinese alphabet, for example.
public static strtoupper UTF-8 aware alternative to strtoupper Make a string uppercase Note: The concept of a characters "case" only exists is some alphabets such as Latin, Greek, Cyrillic, Armenian and archaic Georgian - it does not exist in the Chinese alphabet, for example.
public static substr UTF-8 aware alternative to substr Return part of a string given character offset (and optionally length).
public static substr_replace UTF-8 aware substr_replace Replace text within a portion of a string.
public static transcode Transcode a string.
public static trim UTF-8 aware replacement for Strip whitespace (or other characters) from the beginning and end of a string Note: you only need to use this if you are supplying the charlist optional arg and it contains UTF-8 characters.
public static ucfirst UTF-8 aware alternative to ucfirst Make a string's first character uppercase.
public static ucwords UTF-8 aware alternative to ucwords Uppercase the first character of each word in a string.
public static valid Tests a string as to whether it's valid UTF-8 and supported by the Unicode standard Note: this function has been modified to simple return true or false.
  • Defined in libraries/joomla/utilities/string.php

Importing

jimport( 'joomla.utilities.string' );

See also

SeeAlso:JString [Edit See Also]

User contributed notes

<CodeExamplesForm />