Documentation

JSString
in package
implements Stringable

FinalYes

Allows manipulation and formatting of text strings and determination and location of substrings within strings.

Table of Contents

Interfaces

Stringable

Properties

$length  : int
$length  : int
$value  : string

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.

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
string

charAt()

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
self

indexOf()

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
self

toLowerCase()

Converts all the alphabetic characters in a string to lowercase.

public toLowerCase() : self
Return values
self

toString()

Returns a string representation of a string.

public toString() : string
Return values
string

toUpperCase()

Converts all the alphabetic characters in a string to uppercase.

public toUpperCase() : self
Return values
self

trim()

Removes the leading and trailing white space and line terminator characters from a string.

public trim() : self
Return values
self

trimEnd()

Removes the trailing white space and line terminator characters from a string.

public trimEnd() : self
Return values
self

trimStart()

Removes the leading white space and line terminator characters from a string.

public trimStart() : self
Return values
self

valueOf()

Returns the primitive value of the specified object.

public valueOf() : string
Return values
string

        
On this page

Search results