class PS

An Approximation of a Python String in PHP

Properties

$internal

Methods

__construct($str = false)

No description

set($str = false)

No description

static 
s($str = false)

No description

__toString()

No description

get()

No description

startsWith($needle)

No description

endsWith($needle)

No description

len()

No description

slice($start = 0, $end = -1)

No description

replace($search, $replace)

No description

lower()

No description

upper()

No description

find($sub, $start = 0, $end = -1)

No description

rfind($sub, $start = 0, $end = -1)

No description

strip($characters = false)

emulate python strip()

split($separator = false, $maxsplit = false)

emulate the Python split()

Details

at line 13
__construct($str = false)

Parameters

$str

at line 17
set($str = false)

Parameters

$str

at line 25
static s($str = false)

Parameters

$str

at line 30
__toString()

at line 34
get()

at line 39
startsWith($needle)

Parameters

$needle

at line 44
endsWith($needle)

Parameters

$needle

at line 49
len()

at line 54
slice($start = 0, $end = -1)

Parameters

$start
$end

at line 60
replace($search, $replace)

Parameters

$search
$replace

at line 64
lower()

at line 68
upper()

at line 72
find($sub, $start = 0, $end = -1)

Parameters

$sub
$start
$end

at line 83
rfind($sub, $start = 0, $end = -1)

Parameters

$sub
$start
$end

at line 102
strip($characters = false)

emulate python strip()

string.strip(characters)

characters Optional. A set of characters to remove as leading/trailing characters

txt = ",,,,,rrttgg.....banana....rrr" x = txt.strip(",.grt")

Parameters

$characters

at line 117
split($separator = false, $maxsplit = false)

emulate the Python split()

string.split(separator, maxsplit)

separator Optional. Specifies the separator to use when splitting the string. By default any whitespace is a separator maxsplit Optional. Specifies how many splits to do. Default value is -1, which is "all occurrences"

Note: When maxsplit is specified, the list will contain the specified number of elements plus one.

Parameters

$separator
$maxsplit