class Str (View source)

Methods

static string
upper(string $str)

upper case

static string
lower(string $str)

lower case

static string
camel(string $str)

camel

static mixed
snake(string $str, string $delimiter = '_')

Snake case

static string
plurial(string $str)

Get str plurial

static string
slice(string $str, int $start, int|null $end = null)

slice

static array
split(string $pattern, string $str, string|null $limit = null)

split

static int
pos(string $search, string $string, int $offset = 0)

Get the string position

static bool
contains(string $search, string $str)

Contains

static string
replace(string $pattern, string $replaceBy, string $str)

replace

static string
capitalize(string $str)

capitalize

static int
len(string $str)

Len

static array
wordify(string $str, string $sep = ' ')

Wordify

static string
repeat(string $str, int $number)

Lists the string of characters in a specified number

static string
randomize(int $size = 16)

Randomize

static string
slugify(string $str, string $delimiter = '-')

slugify slug creator using a simple chain.

static string
unSlugify(string $str)

unslugify, Lets you undo a slug

static bool
isMail(string $email)

Check if the email is a valid email.

static bool
isDomain(string $domain)

Check if the string is a domain

static bool
isAlphaNum(string $str)

Check if the string is in alphanumeric

static bool
isNumeric(string $str)

Check if the string is in numeric

static bool
isAlpha(string $str)

Check if the string is in alpha

static bool
isSlug(string $str)

Check if the string is in slug format

static bool
isUpper(string $str)

Check if the string is in uppercase

static bool
isLower(string $str)

Check if the string is lowercase

static int
count(string $pattern, string $str)

Returns the number of characters in a string.

static string
getWords(string $words, int $len)

Returns a determined number of words in a string.

static string
shuffleWords(string $words)

Returns a string of words whose words are mixed.

static void
forceInUTF8()

Enables to force the encoding in utf-8

static string
fixUTF8(string $garbled_utf8_string)

Enables to force the encoding in utf-8

mixed
__call(string $method, array $arguments)

__call

Details

static string upper(string $str)

upper case

Parameters

string $str

Return Value

string

static string lower(string $str)

lower case

Parameters

string $str

Return Value

string

static string camel(string $str)

camel

Parameters

string $str

Return Value

string

static mixed snake(string $str, string $delimiter = '_')

Snake case

Parameters

string $str
string $delimiter

Return Value

mixed

static string plurial(string $str)

Get str plurial

Parameters

string $str

Return Value

string

static string slice(string $str, int $start, int|null $end = null)

slice

Parameters

string $str
int $start
int|null $end

Return Value

string

static array split(string $pattern, string $str, string|null $limit = null)

split

Parameters

string $pattern
string $str
string|null $limit

Return Value

array

static int pos(string $search, string $string, int $offset = 0)

Get the string position

Parameters

string $search
string $string
int $offset

Return Value

int

static bool contains(string $search, string $str)

Contains

Parameters

string $search
string $str

Return Value

bool

static string replace(string $pattern, string $replaceBy, string $str)

replace

Parameters

string $pattern
string $replaceBy
string $str

Return Value

string

static string capitalize(string $str)

capitalize

Parameters

string $str

Return Value

string

static int len(string $str)

Len

Parameters

string $str

Return Value

int

static array wordify(string $str, string $sep = ' ')

Wordify

Parameters

string $str
string $sep

Return Value

array

static string repeat(string $str, int $number)

Lists the string of characters in a specified number

Parameters

string $str
int $number

Return Value

string

static string randomize(int $size = 16)

Randomize

Parameters

int $size

Return Value

string

static string slugify(string $str, string $delimiter = '-')

slugify slug creator using a simple chain.

eg: 'I am a string of character' => 'i-am-a-chain-of-character'

Parameters

string $str
string $delimiter

Return Value

string

static string unSlugify(string $str)

unslugify, Lets you undo a slug

Parameters

string $str

Return Value

string

static bool isMail(string $email)

Check if the email is a valid email.

eg: example@email.com => true

Parameters

string $email

Return Value

bool

static bool isDomain(string $domain)

Check if the string is a domain

eg: http://exemple.com => true eg: http:/exemple.com => false

Parameters

string $domain

Return Value

bool

Exceptions

ErrorException

static bool isAlphaNum(string $str)

Check if the string is in alphanumeric

Parameters

string $str

Return Value

bool

Exceptions

ErrorException

static bool isNumeric(string $str)

Check if the string is in numeric

Parameters

string $str

Return Value

bool

Exceptions

ErrorException

static bool isAlpha(string $str)

Check if the string is in alpha

Parameters

string $str

Return Value

bool

Exceptions

ErrorException

static bool isSlug(string $str)

Check if the string is in slug format

Parameters

string $str

Return Value

bool

Exceptions

ErrorException

static bool isUpper(string $str)

Check if the string is in uppercase

Parameters

string $str

Return Value

bool

static bool isLower(string $str)

Check if the string is lowercase

Parameters

string $str

Return Value

bool

static int count(string $pattern, string $str)

Returns the number of characters in a string.

Parameters

string $pattern
string $str

Return Value

int

static string getWords(string $words, int $len)

Returns a determined number of words in a string.

Parameters

string $words
int $len

Return Value

string

static string shuffleWords(string $words)

Returns a string of words whose words are mixed.

Parameters

string $words

Return Value

string

static void forceInUTF8()

Enables to force the encoding in utf-8

Return Value

void

static string fixUTF8(string $garbled_utf8_string)

Enables to force the encoding in utf-8

Parameters

string $garbled_utf8_string

Return Value

string

mixed __call(string $method, array $arguments)

__call

Parameters

string $method
array $arguments

Return Value

mixed