StringBuilder class

可变的字符序列。字符串缓冲区类似于String ,但可以修改

Implemented types

Constructors

StringBuilder([int capacity = 0])
以指定的初始容量capacity与编码器,初始化StringBuilder
StringBuilder.capacity(int capacity)
指定容量capacity
factory
StringBuilder.from(String str)
指定字符str
factory

Properties

capacity int
no setter
count int
计数是使用的字符数。
getter/setter pair
hashCode int
The hash code for this object.
no setteroverride
isEmpty bool
是否为空
no setter
isNotEmpty bool
是否不为空
no setter
length int
字符串长度
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value Uint16List
该值用于字符存储,使用UTF-16存储字符串。
getter/setter pair

Methods

allMatches(String string, [int start = 0]) Iterable<Match>
Matches this pattern against the string repeatedly.
override
append(dynamic obj, [int start = 0, int? end]) StringBuilder
追加对象,对象会被转换为字符串 参数obj,从索引start ,按顺序附加到此序列的内容,直到(独占)索引end 。该序列的长度增加了end - start的值。
appendAll(Iterable objects, {String? before, String? separator, String? suffix}) StringBuilder
追加对象,对象会被转换为字符串 对象之间会按照separator分割
appendInt(int int16) StringBuilder
追加有符号int16
appendUint(int uInt16) StringBuilder
追加无符号int16
bytes([Encoding encoding = utf8]) List<int>
默认使用utf8将字符串转为无符号字节数组 可选ending asciiutf8latin1systemEncoding
charAt(int index) String
返回指定索引处的String值
clear() StringBuilder
清空字符串
codePoints() List<int>
获取内部集合
codeUnitAt(int index) int
返回指定索引处的int值
compareTo(StringBuilder other) int
Compares this object to another object.
override
delete(int start, int end) StringBuilder
删除此序列的子字符串中的字符。 子字符串从指定的start ,并延伸到索引end - 1处的字符,如果不存在这样的字符,则延伸到序列的末尾。 如果start等于end ,则不进行任何更改
deleteCharAt(int index) StringBuilder
删除此序列中指定位置的uint8 。这个序列缩短了一个uint8 。
indexOf(Pattern pattern) int
返回此字符串中第一次出现指定子字符串的索引。
insert(int index, dynamic obj, [int offset = 0, int? len]) StringBuilder
在指定下标处插入对象,对象会被转换为字符串
lastIndexOf(Pattern pattern, [int? start]) int
返回此字符串中最后一个匹配pattern的起始位置,从start向后搜索
matchAsPrefix(String string, [int start = 0]) Match?
Matches this pattern against the start of string.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
replace(int start, int end, dynamic obj) StringBuilder
将此序列的子字符串中的字符替换为指定String中的字符。 子字符串从指定的start ,并延伸到索引end - 1处的字符,如果不存在这样的字符,则延伸到序列的末尾。 首先删除子字符串中的字符,然后在start处插入指定的String 。
reverse() StringBuilder
substring(int start, [int? end]) String
返回一个新String ,其中包含当前包含在此字符序列中的字符子序列。 子字符串从指定的索引开始并延伸到此序列的末尾。
toString() String
A string representation of this object.
override
trimToSize() → void
尝试减少用于字符序列的存储空间。如果缓冲区大于保存其当前字符序列所需的大小,则可以调整其大小以提高空间效率。

Operators

operator +(StringBuilder strBuffer) StringBuilder
对象相加
operator ==(Object other) bool
The equality operator.
override