JSString
in package
implements
Stringable
Allows manipulation and formatting of text strings and determination and location of substrings within strings.
Table of Contents
Interfaces
- Stringable
Properties
Methods
- __construct() : mixed
- __get() : int|null
- __set() : void
- __toString() : string
- charAt() : self
- Returns the character at the specified index.
- indexOf() : int
- Returns the position of the first occurrence of a substring.
- substring() : self
- Returns the substring at the specified location within a String object.
- toLowerCase() : self
- Converts all the alphabetic characters in a string to lowercase.
- toString() : string
- Returns a string representation of a string.
- toUpperCase() : self
- Converts all the alphabetic characters in a string to uppercase.
- trim() : self
- Removes the leading and trailing white space and line terminator characters from a string.
- trimEnd() : self
- Removes the trailing white space and line terminator characters from a string.
- trimStart() : self
- Removes the leading white space and line terminator characters from a string.
- valueOf() : string
- Returns the primitive value of the specified object.
Properties
$length read-only
public
int
$length
Returns the length of a String object.
$length
private
int
$length
= 0
$value
private
string
$value
= ''
Methods
__construct()
public
__construct([string $value = '' ]) : mixed
Parameters
- $value : string = ''
__get()
public
__get("length" $name) : int|null
Parameters
- $name : "length"
-
Property name
Return values
int|null__set()
public
__set(string $name, mixed $value) : void
Parameters
- $name : string
- $value : mixed
__toString()
public
__toString() : string
Return values
stringcharAt()
Returns the character at the specified index.
public
charAt(int|float $pos) : self
Parameters
- $pos : int|float
-
The zero-based index of the desired character.
Return values
selfindexOf()
Returns the position of the first occurrence of a substring.
public
indexOf([string|null $searchString = null ][, int<0, max> $position = 0 ]) : int
Parameters
- $searchString : string|null = null
-
The substring to search for in the string
- $position : int<0, max> = 0
-
The index at which to begin searching the String object. If omitted, search starts at the beginning of the string.
Return values
int —The index of the first occurrence of searchString found, or -1 if not found.
substring()
Returns the substring at the specified location within a String object.
public
substring(int $start[, int|null $end = null ]) : self
Parameters
- $start : int
-
The zero-based index number indicating the beginning of the substring.
- $end : int|null = null
-
Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. If end is omitted, the characters from start through the end of the original string are returned.
Return values
selftoLowerCase()
Converts all the alphabetic characters in a string to lowercase.
public
toLowerCase() : self
Return values
selftoString()
Returns a string representation of a string.
public
toString() : string
Return values
stringtoUpperCase()
Converts all the alphabetic characters in a string to uppercase.
public
toUpperCase() : self
Return values
selftrim()
Removes the leading and trailing white space and line terminator characters from a string.
public
trim() : self
Return values
selftrimEnd()
Removes the trailing white space and line terminator characters from a string.
public
trimEnd() : self
Return values
selftrimStart()
Removes the leading white space and line terminator characters from a string.
public
trimStart() : self
Return values
selfvalueOf()
Returns the primitive value of the specified object.
public
valueOf() : string