去中常用包笔记字符串字符串(四)

包字符串

func NewReplacer (oldnew…字符串)*代用品//构造函数,不定参数,参数格式为old1,,不丹old2, new2, old3, new3……表示old1会被替换为,不丹old2会被替换为new2…

,,,func (r *代用品)替换字符串(字符串)//进行替换返回新的字符串

,,,func (r *代用品)WriteString (w。作者,年代字符串)(n int,犯错错误)//替换后并写入io。作家


<强>其他和字节包类似功能的方法:

包含,转换


分割分组,将分组连接成字符串分割大小写转换,修剪两端按规则修改包含的每个重复,替换

<>强类型读者

,func才能NewReader(字符串)*读者

,,,func (r *读者)int Len ()

,,,func (r *读者)阅读(b[]字节)(n int,犯错错误)

,,,func (r *读者)ReadAt (b[]字节,int64) (n int,犯错错误)

,,,func (r *读者)ReadByte()(字节,错误)

,,,func (r *读者)ReadRune () (ch符文,大小int,犯错错误)

,func (r *读者)才能重置(字符串)

,,,func (r *读者)寻求(抵消int64, int) (int64、错误)

,,,func (r *读者)大小()int64

,,,func (r *读者)UnreadByte()错误

,,,func (r *读者)UnreadRune()错误

,,,func (r *读者)用WriteTo (w io.Writer) (n int64,犯错错误)




去中常用包笔记字符串字符串(四)