正在加载图片...
(4)串连接 Concat(t) 将当前串和申t的所有字符连接在一起形成的新串,并返 回这个新串。对应的算法如下: public sqstring class Concat(sqstring Class t) AsTring Class nstr= new SqString Class;/新建一个空串 int i. nstr length=length+t ength: for(i=0;i< length;i计+)∥将当前串data0. str length-1到nsr nstr.dataiFdata; for(i=0; i<t length; i++)//t data O.t. length-1-nstr nstrdata length+i=tdata; return nstr; 返回新串nstr(4)串连接Concat(t) 将当前串和串t的所有字符连接在一起形成的新串,并返 回这个新串。对应的算法如下: public SqStringClass Concat(SqStringClass t) { SqStringClass nstr=new SqStringClass(); //新建一个空串 int i; nstr.length=length+t.length; for (i=0;i<length;i++)//将当前串data[0..str.length-1]到nstr nstr.data[i]=data[i]; for (i=0;i<t.length;i++)//将t.data[0..t.length-1]nstr nstr.data[length+i]=t.data[i]; return nstr; //返回新串nstr }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有