Strings Library



( ZN >= 2.0.0 )

A class developed to perform a number of operations on textual expressions.

 

# Methods


String mtrim ( String $ str )
String trimSlashes ( String $ str )
String casing ( String $ str , String $ type = 'lower' , String $ encoding = 'utf-8' )
String upperCase ( String $ str , String $ encoding = 'utf-8' )
String lowerCase ( String $ str , String $ encoding = 'utf-8' )
String titleCase ( String $ str , String $ encoding = 'utf-8' )
String camelCase ( String $ str )
String pascalCase ( String $ str )
String search ( String $ str , String $ needle , String $ type = 'string' , Bool $ case = true )
Int searchPosition ( String $ str , String $ needle , Bool $ case = true )
String searchString ( String $ str , String $ needle , Bool $ case = true )
String reshuffle ( String $ str , String $ shuffle , String $ reshuffle )
Int recurrentCount ( String $ str , String $ char )
String placement ( String $ str , String $ delimiter , Array $ array )
String section ( String $ str , Int $ starting = 0 , Int $ count = NULL , String $ encoding = 'utf-8' )
String replace ( string $ string , Mixed $ oldch are , Mixed $ newch is = NULL , Boolean $ casa = true )
Array toArray ( String $ string , String $ split = '' )
Array split ( String $ string , Int $ count = 1 )
String toChar ( Int $ ascii )
Int toAscii ( String $ string )
String addSlashes ( String $ string , String $ addDifferentChars = NULL )
String removeSlashes ( String $ string )
Int length ( String $ string , String $ encoding = 'utf-8' )
String encode ( String $ string , String $ salt = 'default' )
String repeat ( String $ string , Int $ count = 1 )
String appportion ( String $ string , Int $ length = 76 , String $ end = "")
String divide ( String $ str , String $ separator = '|' , Scalar $ index = 0 )
String pad ( String $ string , Int $ count = 1 , String $ chars = ' , String $ type = ' right ' )

 

# Mtim ( ZN >= 2.0.0 )


It is used to clear gaps in textual expressions. These include line head, line end, and tab characters.

Parameters

String $ Str Relevant string.
return String

Use of

echo Strings::mtrim(' Zn framework ');
Znframework 

 

# TrimSlashes ( ZN >= 2.0.0 )


Textual expressions are used to clear the leading and trailing slash marks.

Parameters

String $ Str Relevant string.
return String

Use of

echo Strings::trimSlashes('/product/computer/12/');
product / computer / 12

 

# Casing ( ZN >= 2.0.0 )


Used to convert uppercase and lowercase letters in textual expressions.

Parameters

String $ Str Relevant string.
String $ type = 'lower' What to convert.
Options lower , upper , title
String $ encoding = 'utf-8' Encoding type.
return String

Use of

\Output::writeLine( Strings::casing('Zn framework') );
\Output::writeLine( Strings::casing('Zn framework', 'upper') );
\Output::writeLine( Strings::casing('Zn framework', 'title') );
zn framework
ZN FRAMEWORK
Zn Framework 

 

# UpperCase ( ZN >= 2.0.0 )


It is used to convert textual expressions to uppercase.

Parameters

String $ Str Relevant string.
String $ encoding = 'utf-8' Encoding type.
return String

Use of

\Output::writeLine( Strings::upperCase('Zn framework') );
ZN FRAMEWORK 

 

# LowerCase ( ZN> = 2.0.0 )


It is used to convert textual expressions to lowercase.

Parameters

String $ Str Relevant string.
String $ encoding = 'utf-8' Encoding type.
return String

Use of

\Output::writeLine( Strings::lowerCase('Zn framework') );
zn framework 

 

# TitleCase ( ZN> = 2.0.0 )


It is used to convert only the first letter of the textual expressions to upper case.

Parameters

String $ Str Relevant string.
String $ encoding = 'utf-8' Encoding type.
return String

Use of

\Output::writeLine( Strings::titleCase('Zn framework') );
Zn Framework 

 

# CamelCase ( ZN >= 2.0.0 )


This method translates to camelCase coding notation.

Parameters

String $ Str Relevant string.
String $ encoding = 'utf-8' Encoding type.
return String

Use of

\Output::writeLine( Strings::camelCase('Zn framework') );
znframework 

 

# PascalCase ( ZN >= 2.0.0 )


This method translates to pascalCase coding notation.

Parameters

String $ Str Relevant string.
String $ encoding = 'utf-8' Encoding type.
return String

Use of

\Output::writeLine( Strings::pascalCase('Zn framework') );
znframework 

 

# Search ( ZN> = 2.0.0 )


It is used to search for textual expressions.

Parameters

String $ Str Relevant string.
String $ Needle The string sought.
Options string , position
Bool $ case = true Case sensitivity.
return Mixed

Use of

\Output::writeLine( Strings::search('Zn framework', 'frame') );
\Output::writeLine( Strings::search('Zn framework', 'Frame', 'string', false) );
\Output::writeLine( Strings::search('Zn framework', 'frame', 'position') );
framework
framework

 

# SearchPosition ( ZN >= 2.0.0 )


It is used to search for textual expressions. If the value is found, the index number of the first character of that value is returned.

Parameters

String $ Str Relevant string.
String $ Needle The string sought.
Bool $ case = true Case sensitivity.
return Int

Use of

\Output::writeLine( Strings::searchPosition('Zn framework', 'Frame', false) );

 

# SearchString ( ZN> = 2.0.0 )


It is used to search for textual expressions. If value is found, it returns value and continuation.

Parameters

String $ Str Relevant string.
String $ Needle The string sought.
Bool $ case = true Case sensitivity.
return String

Use of

\Output::writeLine( Strings::searchString('Zn framework', 'frame') );
\Output::writeLine( Strings::searchString('Zn framework', 'Frame', false) );
framework
framework 

 

# Reshuffle ( ZN >= 2.0.0 )


It is used to replace the desired character or words in textual expressions.

Parameters

String $ Str Relevant string.
String $ Shuffle The shifting string.
String $ Reshuffle The shifting string.
return String

Use of

\Output::writeLine( Strings::reshuffle('Zn framework', 'Zn', 'framework') );
framework Zn 

 

# RecurrentCount ( ZN >= 2.0.0 )


Textual expressions are used to learn the number of repetitive texts.

Parameters

String $ Str Relevant string.
String $ Char Repeat string.
return Int

Use of

\Output::writeLine( Strings::recurrentCount('Foo bar baz baz coo baz', 'baz') );
3

 

# Placement ( ZN> = 2.0.0 )


str_replace()Unlike this method , it specifies which characters will come in order with the character to be replaced instead.

Parameters

String $ Str Relevant string.
String $ Delimiter The characters to place the string in.
Array $ array Which strings are to be placed in places marked with parameter 2
return String

Use of

\Output::writeLine( Strings::placement('Foo bar baz baz coo baz', 'baz', ['BAZ', 'BAR', 'FOO']) );
Foo bar BASE BAR COO FOO 

 

# Section ( ZN >= 2.0.0 )


It is used to take a cross-section. mb_substr()object-oriented use of the function.

Parameters

String $ Str Relevant string.
Int $ starting = 0 The number of indications for the section will begin.
Int $ count = NULL How many characters will be taken.
String $ encoding = 'utf-8' Encoding type.
return String

Use of

\Output::writeLine( Strings::section('Foo bar baz baz coo baz', 4, 3) );
\Output::writeLine( Strings::section('Foo bar baz baz coo baz', 8, 3) );
bar
base 

 

# Replace ( ZN >= 2.0.0 )


Used to make changes on string value. str_replace()object-oriented use of the function.

Parameters

String $ Str Relevant string.
Mixed $ oldchars Characters to be changed
Mixed $ newchars 2. New characters to replace the parameter characters.
Bool $ case = true Case sensitivity.
return String

Use of

\Output::writeLine( Strings::replace('Foo bar baz baz coo baz', ['baz', 'Coo'], ['BAZ', 'COO']) );
\Output::writeLine( Strings::replace('Foo bar baz baz coo baz', ['baz', 'Coo'], ['BAZ', 'COO'], false) );
Foo bar BASE BASE coo BASE
FOO bar BASE BASE COO BOOK 

 

# toArray ( ZN >= 2.0.0 )


Dizgeyi is used to turn the string.

Parameters

String $ Str Relevant string.
String $ split = '' Which characters to divide.
return Array

Use of

output( Strings::toArray('Foo bar baz baz coo baz', '') );
output( Strings::toArray('Foo bar baz baz coo baz', 'bar') );
0 => string 'F' (length = 3 ) ,
1 => string 'o' (length = 3 ) ,
2 => string 'o' (length = 3 ) ,
3 => string ' (length = 3 ) ,
4 => string 'b' (length = 3 ) ,
5 => string 'a' (length = 3 ),
6 => string 'r' (length = 3 ) ,
7 => string ' (length = 3 ) ,
8 => string ' b ' (length = 3 ) ,
9 => string ' a ' (length = 3 ) ,
10 => string 'z' (length = 3 ) ,
11 => string '' (length = 3) ,
12 => string 'b' (length = 3 ) ,
13 => string 'a' (length = 3 ) ,
14 => string 'z' (length = 3 ) ,
15 => string ' (length = 3 ) ,
16 => string 'c' (length = 3 ) ,
17 => string 'o' (length =3 ) ,
18 => string 'o' (length = 3 ) ,
19 => string ' (length = 3 ) ,
20 => string ' b ' (length = 3 ) ,
21 => string ' a ' (length = 3 ) ,
22 => string 'z' (length = 3 )

--------------------------------
0 = > string 'Foo' (length = 6 ) ,
1 => string 'base base coo base' (length = 18 )

 

# Split ( ZN >= 4.2.7 )


Dizgeyi is used to separate characters into a certain number of characters.

Parameters

String $ Str Relevant string.
Int $ count = 1 Run away, run away.
return Array

Use of

output( Strings::split('FooBar', 3) );
0 => string 'Foo' (length = 3 ) ,
1 => string 'Bar' (length = 3 )

 

# ToChar ( ZN >= 2.0.0 )


Used to obtain the character offset of the ascii code.

Parameters

Int $ Ascii Ascii code.
return Array

Use of

\Output::writeLine( Strings::toChar(65) );
to

 

# ToAscii ( ZN >= 2.0.0 )


It is used to get the pseudo-code of the character.

Parameters

String $ Char Character
return Int

Use of

\Output::writeLine( Strings::toChar('A') );
65