\ScriptBuilder

在StringBuilder的基础之上增加了更加方便的字符串替换方法

Summary

Methods
Properties
Constants
__construct()
Replace()
AppendLine()
Append()
Clear()
ToString()
offsetSet()
offsetExists()
offsetUnset()
offsetGet()
No public properties found
No constants found
No protected methods found
$buffer
N/A
No private methods found
$newLine
N/A

Properties

$buffer

$buffer : string

最终所生成的字符串数据

Type

string

$newLine

$newLine : string

Type

string

Methods

__construct()

__construct(string  $string = NULL,   $newLine = PHP_EOL) 

Parameters

string $string

The initialize string buffer

$newLine

Replace()

Replace(string  $find, string  $replaceValue) : \StringBuilder

Parameters

string $find
string $replaceValue

Returns

\StringBuilder

AppendLine()

AppendLine(  $str = "") : \StringBuilder

Appends the default line terminator, or a copy of a specified string and the default line terminator, to the end of this instance.

Parameters

$str

Returns

\StringBuilder

Append()

Append(string  $str) : \StringBuilder

Append the text into buffer without add new line

Parameters

string $str

The text for append into buffer.

Returns

\StringBuilder

return current object instance.

Clear()

Clear() 

Removes all characters from the current StringBuilder instance.

ToString()

ToString() : string

Converts the value of a StringBuilder to a String.

将当前的这个StringBuilder对象之中的字符串缓冲字符串输出

Returns

string —

最终所拼接出来的文本字符串数据

offsetSet()

offsetSet(integer  $offset, string  $value) 

Symbol expression: @symbol

Parameters

integer $offset

Char at index/symbol

string $value

A char(string with one character)

offsetExists()

offsetExists(integer  $offset) : boolean

Find substring is exists on buffer or not?

Parameters

integer $offset

index should be positive integer and in range of the string length.

Returns

boolean

offsetUnset()

offsetUnset(integer  $offset) 

Will replace the char in position offset to a blank space

Parameters

integer $offset

offsetGet()

offsetGet(integer  $offset) : string

The implemented ``CharAt`` function.

Parameters

integer $offset

Returns

string