xlang v4.0 Release
程序设计语言基础库文档
载入中...
搜索中...
未找到
Public 成员函数 | 静态 Public 成员函数 | 包函数
StringBuffer类 参考

字符串缓冲类 更多...

Public 成员函数

静态 Public 成员函数

包函数

详细描述

字符串缓冲类

警告
该对象不同于String, 内容可改变

在文件 BuiltinObjects.x1507 行定义.

构造及析构函数说明

◆ StringBuffer() [1/18]

void StringBuffer ( )

◆ StringBuffer() [2/18]

void StringBuffer ( byte  [])

◆ StringBuffer() [3/18]

void StringBuffer ( int  )

◆ StringBuffer() [4/18]

void StringBuffer ( byte  [],
int  ,
int   
) throws IndexOutOfBoundsException, IllegalArgumentException

◆ StringBuffer() [5/18]

void StringBuffer ( char  [],
bool   
)

◆ StringBuffer() [6/18]

void StringBuffer ( char  [],
int  ,
int  ,
bool   
) throws IndexOutOfBoundsException, IllegalArgumentException

◆ StringBuffer() [7/18]

void StringBuffer ( byte  [],
  String 
)

◆ StringBuffer() [8/18]

void StringBuffer ( byte  [],
int  ,
int  ,
  String 
) throws IndexOutOfBoundsException, IllegalArgumentException

◆ StringBuffer() [9/18]

void StringBuffer ( String  )

◆ StringBuffer() [10/18]

StringBuffer ( )
package

默认构造

◆ StringBuffer() [11/18]

StringBuffer ( byte []  data)
package

从byte数组构造对象

参数
databyte数组

◆ StringBuffer() [12/18]

StringBuffer ( int  Capacity)
package

构造默认容量的对象

参数
Capacity字节大小

◆ StringBuffer() [13/18]

StringBuffer ( byte []  data,
int  offset,
int  length 
)
package

从byte数组构造对象

参数
databyte数组
offsetdata中的指针
length长度

◆ StringBuffer() [14/18]

StringBuffer ( char []  data,
bool  bLittleEndian 
)
package

从Char数组(UTF16)构造对象

参数
datachar数组
bLittleEndian是否小端

◆ StringBuffer() [15/18]

StringBuffer ( char []  data,
int  offset,
int  length,
bool  bLittleEndian 
)
package

从Char数组(UTF16)构造对象

参数
datachar数组
offsetdata中的指针
length长度
bLittleEndian是否小端

◆ StringBuffer() [16/18]

StringBuffer ( byte []  data,
String  charset 
)
package

从byte数组构造对象

参数
databyte数组
charset指定data的字符集

◆ StringBuffer() [17/18]

StringBuffer ( byte []  data,
int  offset,
int  length,
String  charset 
)
package

从byte数组构造对象

参数
datachar数组
offsetdata中的指针
length长度
charset指定data的字符集

◆ StringBuffer() [18/18]

StringBuffer ( String  text)
package

从String构造对象

参数
textstring对象

成员函数说明

◆ append() [1/9]

StringBuffer append ( byte []  data,
int  offset,
int  length 
)
package

增加数据

参数
databyte数组
offsetdata中的指针
length长度

◆ append() [2/9]

StringBuffer append ( byte  [],
int  ,
int   
) throws IndexOutOfBoundsException, IllegalArgumentException

◆ append() [3/9]

StringBuffer append ( char  sub)
package

连接对象并产生新串

参数
sub用以连接的对象
返回
新串

◆ append() [4/9]

StringBuffer append ( char  )

◆ append() [5/9]

StringBuffer append ( char []  data,
int  offset,
int  length,
bool  bLittleEndian 
)
package

增加数据

参数
datachar数组
offsetdata中的指针
length长度
bLittleEndian是否小端

◆ append() [6/9]

StringBuffer append ( char  [],
int  ,
int  ,
bool   
) throws IndexOutOfBoundsException, IllegalArgumentException

◆ append() [7/9]

StringBuffer append ( int  )

◆ append() [8/9]

StringBuffer append ( String  sub)
package

连接对象并产生新串

参数
sub用以连接的对象
返回
新串

◆ append() [9/9]

StringBuffer append ( String  )

◆ appendFill() [1/2]

StringBuffer appendFill ( char  c,
int  length 
)
package

构造一个全以字符c组成的长度为length的字符串

返回
结果

◆ appendFill() [2/2]

StringBuffer appendFill ( char  ,
int   
) throws IllegalArgumentException

◆ appendPath() [1/2]

StringBuffer appendPath ( String  str)
package

连接路径,该方法会按照平台使用不同的\的/来连接路径串

参数
str子路径
返回
结果

◆ appendPath() [2/2]

StringBuffer appendPath ( String  )

◆ capacity() [1/2]

int capacity ( )

◆ capacity() [2/2]

int capacity ( )
package

获取容量

返回
结果

◆ charAt() [1/2]

char charAt ( int  pos)
package

获取字符串指定位置的字符

返回
结果

◆ charAt() [2/2]

char charAt ( int  )

◆ charset() [1/2]

String charset ( )

◆ charset() [2/2]

String charset ( )
package

检测字符集

返回
结果

◆ clear() [1/2]

void clear ( )

◆ clear() [2/2]

StringBuffer clear ( )
package

清空内容

返回
结果

◆ compare() [1/2]

int compare ( String  other)
package

比较字符串

返回
结果

◆ compare() [2/2]

int compare ( String  )

◆ countChar() [1/2]

int countChar ( char  c)
package

统计字符串中字符出现的次数

参数
c字符
返回
计数

◆ countChar() [2/2]

int countChar ( char  )

◆ countString() [1/2]

int countString ( String  str)
package

统计字符串中另一个串出现的次数

参数
str另一个串
返回
计数

◆ countString() [2/2]

int countString ( String  )

◆ countStringIgnoreCase() [1/2]

int countStringIgnoreCase ( String  str)
package

统计字符串中另一个串(忽略大小写)出现的次数

参数
str另一个串
返回
计数

◆ countStringIgnoreCase() [2/2]

int countStringIgnoreCase ( String  )

◆ decodeURI() [1/2]

StringBuffer decodeURI ( )

◆ decodeURI() [2/2]

StringBuffer decodeURI ( )
package

将URI转换为字符串

返回
结果

◆ encodeURI() [1/2]

StringBuffer encodeURI ( bool  bComponent)
package

转换为URI

返回
结果

◆ encodeURI() [2/2]

StringBuffer encodeURI ( bool  )

◆ endsWith() [1/2]

bool endsWith ( String  sub)
package

测试串是否由另一个字串结尾

参数
sub用以匹配的串
返回
是/否

◆ endsWith() [2/2]

bool endsWith ( String  )

◆ equals() [1/2]

bool equals ( String  other)
package

测试两个串是否相等

参数
other另一个串
返回
比较结果

◆ equals() [2/2]

bool equals ( String  )

◆ equalsIgnoreCase() [1/2]

bool equalsIgnoreCase ( String  other)
package

忽略大小写并比较两个串是否相等

参数
other另一个串
返回
比较结果

◆ equalsIgnoreCase() [2/2]

bool equalsIgnoreCase ( String  )

◆ escape() [1/2]

StringBuffer escape ( )

◆ escape() [2/2]

StringBuffer escape ( )
package

消除串中的转义字符 并返回一个新串

返回
新串

◆ finalize()

void finalize ( )

◆ find() [1/4]

int find ( String  sub)
package

在串中查找子串

参数
sub子串
返回
找到的位置 找不到返回-1

◆ find() [2/4]

int find ( String  sub,
int  offset,
int  length 
)
package

在串中查找子串

参数
sub子串
offset子串中的起始位置
length长度
返回
找到的位置 找不到返回-1

◆ find() [3/4]

int find ( String  )

◆ find() [4/4]

int find ( String  ,
int  ,
int   
) throws IllegalArgumentException

◆ findExtension() [1/2]

String findExtension ( )

◆ findExtension() [2/2]

String findExtension ( )
package

当串为文件名时,寻找扩展名 并生成新串

返回
结果

◆ findFilename() [1/2]

String findFilename ( )

◆ findFilename() [2/2]

String findFilename ( )
package

当串为文件名时,寻找文件名 并生成新串

返回
结果

◆ findFilenameAndExtension() [1/2]

String findFilenameAndExtension ( )

◆ findFilenameAndExtension() [2/2]

String findFilenameAndExtension ( )
package

当串为文件名时,寻找文件名与扩展名 并生成新串

返回
结果

◆ findPathFilename() [1/2]

String findPathFilename ( )

◆ findPathFilename() [2/2]

String findPathFilename ( )
package

当串为文件名时,寻找路径和文件名 并生成新串

返回
结果

◆ findVolume() [1/2]

String findVolume ( )

◆ findVolume() [2/2]

String findVolume ( )
package

当串为文件名时,寻找卷名(限WINDOWS) 并生成新串

返回
结果

◆ findVolumePath() [1/2]

String findVolumePath ( )

◆ findVolumePath() [2/2]

String findVolumePath ( )
package

当串为文件名时,寻找卷名与路径名 并生成新串

返回
结果

◆ formatPath() [1/2]

static final StringBuffer formatPath ( bool  )
static

◆ formatPath() [2/2]

StringBuffer formatPath ( String  str,
bool  bReslash 
)
package

格式化路径 该方法将消除路径中的 // /./ /../ 以及其他不正确的斜杠和反斜杠

参数
str路径字符串
bReslash是否使用反斜杠
返回
结果

◆ getBytes() [1/4]

byte [] getBytes ( )

◆ getBytes() [2/4]

byte [] getBytes ( )
package

获取串的byte数组内容

返回
数组

◆ getBytes() [3/4]

byte [] getBytes ( String  charset)
package

获取串的byte数组内容

参数
charset要获取的byte[]字符集
返回
数组

◆ getBytes() [4/4]

byte [] getBytes ( String  ) throws IllegalArgumentException

◆ indexOf() [1/6]

int indexOf ( char  c,
int  pos 
)
package

从串的前面查找一个字符的位置

参数
sub用以匹配的字符
pos开始查找的位置
返回
位置, 找不到返回-1

◆ indexOf() [2/6]

int indexOf ( char  )

◆ indexOf() [3/6]

int indexOf ( char  ,
int   
) throws IllegalArgumentException

◆ indexOf() [4/6]

int indexOf ( String  sub,
int  pos 
)
package

从串的前面查找另一个穿的位置

参数
sub用以匹配的串
pos开始查找的位置
返回
位置, 找不到返回-1

◆ indexOf() [5/6]

int indexOf ( String  )

◆ indexOf() [6/6]

int indexOf ( String  ,
int   
) throws IllegalArgumentException

◆ insert() [1/4]

StringBuffer insert ( int  pos,
char  sub 
)
package

在串的指定位置插入一个字符,并生成新串

参数
pos插入的位置
sub插入的字符
返回
新串

◆ insert() [2/4]

StringBuffer insert ( int  pos,
String  sub 
)
package

在串的指定位置插入一个新串,并生成新串

参数
pos插入的位置
sub插入的子串
返回
新串

◆ insert() [3/4]

StringBuffer insert ( int  ,
char   
) throws IllegalArgumentException

◆ insert() [4/4]

StringBuffer insert ( int  ,
  String 
) throws IllegalArgumentException

◆ isDigit() [1/2]

bool isDigit ( )

◆ isDigit() [2/2]

bool isDigit ( )
package

测试串是否数字

返回
是/否

◆ isDot() [1/2]

bool isDot ( )

◆ isDot() [2/2]

bool isDot ( )
package

当串为文件名时,测试串是否为. 或者..

返回
结果

◆ lastIndexOf() [1/6]

int lastIndexOf ( char  sub,
int  pos 
)
package

从串的后面查找一个字符的位置

参数
sub用以匹配的字符
pos开始查找的位置
返回
位置, 找不到返回-1

◆ lastIndexOf() [2/6]

int lastIndexOf ( char  )

◆ lastIndexOf() [3/6]

int lastIndexOf ( char  ,
int   
) throws IllegalArgumentException

◆ lastIndexOf() [4/6]

int lastIndexOf ( String  sub,
int  pos 
)
package

从串的后面查找另一个穿的位置

参数
sub用以匹配的串
pos开始查找的位置
返回
位置, 找不到返回-1

◆ lastIndexOf() [5/6]

int lastIndexOf ( String  )

◆ lastIndexOf() [6/6]

int lastIndexOf ( String  ,
int   
) throws IllegalArgumentException

◆ length() [1/2]

int length ( )

◆ length() [2/2]

int length ( )
package

获取字串长度

返回
长度

◆ lower() [1/2]

StringBuffer lower ( )

◆ lower() [2/2]

StringBuffer lower ( )
package

转换为小写 生成一个新串

返回
新串

◆ ltrim() [1/2]

StringBuffer ltrim ( bool  bc)
package

去除串左端的空白字符 并生成新串

参数
bc指定是否将ASCII 0-0x20的控制字符全部删掉
返回
结果

◆ ltrim() [2/2]

StringBuffer ltrim ( bool  )

◆ operator +=() [1/7]

StringBuffer operator += ( bool  two)
package

串和对象相加

参数
two要相加的对象
返回
新串

◆ operator +=() [2/7]

StringBuffer operator += ( byte  two)
package

串和对象相加

参数
two要相加的对象
返回
新串

◆ operator +=() [3/7]

StringBuffer operator += ( char  two)
package

串和对象相加

参数
two要相加的对象
返回
新串

◆ operator +=() [4/7]

StringBuffer operator += ( double  two)
package

串和对象相加

参数
two要相加的对象
返回
新串

◆ operator +=() [5/7]

StringBuffer operator += ( int  two)
package

串和对象相加

参数
two要相加的对象
返回
新串

◆ operator +=() [6/7]

StringBuffer operator += ( long  two)
package

串和对象相加

参数
two要相加的对象
返回
新串

◆ operator +=() [7/7]

StringBuffer operator += ( String  two)
package

串和对象相加

参数
two要相加的对象
返回
新串

◆ operator+=() [1/9]

StringBuffer operator+= ( bool  )

◆ operator+=() [2/9]

StringBuffer operator+= ( byte  )

◆ operator+=() [3/9]

StringBuffer operator+= ( char  )

◆ operator+=() [4/9]

StringBuffer operator+= ( double  )

◆ operator+=() [5/9]

StringBuffer operator+= ( float  )

◆ operator+=() [6/9]

StringBuffer operator+= ( int  )

◆ operator+=() [7/9]

StringBuffer operator+= ( long  )

◆ operator+=() [8/9]

StringBuffer operator+= ( short  )

◆ operator+=() [9/9]

StringBuffer operator+= ( String  )

◆ operator[]()

char operator[] ( int  ) throws IllegalArgumentException

◆ parseBool() [1/2]

bool parseBool ( )

◆ parseBool() [2/2]

bool parseBool ( )
package

解析为bool对象

返回
解析结果, 失败返回false, 需要抛出异常的请使用Math类方法

◆ parseDouble() [1/2]

double parseDouble ( )

◆ parseDouble() [2/2]

double parseDouble ( )
package

解析为double对象

返回
解析结果, 失败返回0, 需要抛出异常的请使用Math类方法

◆ parseFloat() [1/2]

float parseFloat ( )

◆ parseFloat() [2/2]

float parseFloat ( )
package

解析为float对象

返回
解析结果, 失败返回0, 需要抛出异常的请使用Math类方法

◆ parseHex() [1/2]

long parseHex ( )

◆ parseHex() [2/2]

long parseHex ( )
package

解析为十六进制long对象

返回
解析结果, 失败返回0, 需要抛出异常的请使用Math类方法

◆ parseInt() [1/2]

int parseInt ( )

◆ parseInt() [2/2]

int parseInt ( )
package

解析为int对象

返回
解析结果, 失败返回0, 需要抛出异常的请使用Math类方法

◆ parseLong() [1/2]

long parseLong ( )

◆ parseLong() [2/2]

long parseLong ( )
package

解析为long对象

返回
解析结果, 失败返回0, 需要抛出异常的请使用Math类方法

◆ parseMarkdown()

String parseMarkdown ( )
package

将一个markdown字符串转换为HTML字符串

返回
结果

◆ removeExtension() [1/2]

StringBuffer removeExtension ( )

◆ removeExtension() [2/2]

StringBuffer removeExtension ( )
package

当串为文件名时,删除扩展名 并生成新串

返回
结果

◆ replace() [1/4]

StringBuffer replace ( int  start,
int  end,
String  sub 
)
package

将串中指定的部分替换为另一个串

参数
start起始
end结束
sub另一个串
返回
新串

◆ replace() [2/4]

StringBuffer replace ( int  ,
int  ,
  String 
) throws IllegalArgumentException

◆ replace() [3/4]

StringBuffer replace ( String  find,
String  rep 
)
package

在串中查找子串并替换为另一个串

参数
find要查找的串
rep用以替换的串
返回
新串

◆ replace() [4/4]

StringBuffer replace ( String  ,
  String 
)

◆ replaceExtension() [1/2]

StringBuffer replaceExtension ( String  newExtName)
package

当串为文件名时,替换扩展名 并生成新串

参数
newExtName新扩展名
返回
结果

◆ replaceExtension() [2/2]

StringBuffer replaceExtension ( String  )

◆ replaceFilename() [1/2]

StringBuffer replaceFilename ( String  newName)
package

当串为文件名时,替换文件名(保留扩展名) 并生成新串

参数
newExtName新文件名
返回
结果

◆ replaceFilename() [2/2]

StringBuffer replaceFilename ( String  )

◆ replaceFilenameAndExtension() [1/2]

StringBuffer replaceFilenameAndExtension ( String  newExtName)
package

当串为文件名时,替换文件名与扩展名 并生成新串

参数
newExtName新文件名和扩展名
返回
结果

◆ replaceFilenameAndExtension() [2/2]

StringBuffer replaceFilenameAndExtension ( String  )

◆ resizeCapacity() [1/2]

StringBuffer resizeCapacity ( int  other)
package

重设容量

返回
结果

◆ resizeCapacity() [2/2]

StringBuffer resizeCapacity ( int  )

◆ rtrim() [1/2]

StringBuffer rtrim ( bool  bc)
package

去除串右端的空白字符 并生成新串

参数
bc指定是否将ASCII 0-0x20的控制字符全部删掉
返回
结果

◆ rtrim() [2/2]

StringBuffer rtrim ( bool  )

◆ split() [1/4]

String [] split ( char  dim)
package

在串中截取子串

参数
dim分割符
返回
分割后的字符串数组

◆ split() [2/4]

String [] split ( char  )

◆ split() [3/4]

String [] split ( String  dim)
package

在串中截取子串

参数
dim分割符
返回
分割后的字符串数组

◆ split() [4/4]

String [] split ( String  )

◆ startsWith() [1/2]

bool startsWith ( String  sub)
package

测试串是否由另一个字串起始

参数
sub用以匹配的串
返回
是/否

◆ startsWith() [2/2]

bool startsWith ( String  )

◆ substring() [1/3]

String substring ( int  start,
int  end 
)
package

在串中截取子串

参数
start起始位置
end结束位置
返回
新串

◆ substring() [2/3]

String substring ( int  ) throws IllegalArgumentException

◆ substring() [3/3]

String substring ( int  ,
int   
) throws IllegalArgumentException

◆ toAbsolutePath() [1/2]

StringBuffer toAbsolutePath ( String  refPath)
package

转换到绝对路径

参数
refPath参考路径
返回
结果

◆ toAbsolutePath() [2/2]

StringBuffer toAbsolutePath ( String  )

◆ toCharArray() [1/2]

byte [] toCharArray ( bool  bLittleEndian)
package

获取串的char数组(UTF16)内容

参数
bLittleEndian是否小端
返回
数组

◆ toCharArray() [2/2]

char [] toCharArray ( bool  )

◆ toRelativePath() [1/2]

StringBuffer toRelativePath ( String  refPath,
bool  ignoreCase,
bool  correct_slash 
)
package

转换到相对路径

参数
refPath参考路径 @prarm ignoreCase 忽略大小写
correct_slash更正斜杠
返回
结果

◆ toRelativePath() [2/2]

StringBuffer toRelativePath ( String  ,
bool  ,
bool   
)

◆ toString() [1/2]

String toString ( )

◆ toString() [2/2]

String toString ( )
package

转到字符串

返回
结果

◆ trim() [1/2]

StringBuffer trim ( bool  bc)
package

去除串两端的空白字符 并生成新串

参数
bc指定是否将ASCII 0-0x20的控制字符全部删掉
返回
结果

◆ trim() [2/2]

StringBuffer trim ( bool  )

◆ upper() [1/2]

StringBuffer upper ( )

◆ upper() [2/2]

StringBuffer upper ( )
package

转换为大写 生成一个新串

返回
新串