121212.png (99.33 KB, 下载次数: 35)
内容详情
煮酒拭剑赏美人 发表于 2016-9-23 09:32
我什么也看不到,除了一个标题
String text1 ="ABCDEF";
//目标字符数组
char[] chars = new char[10];
//拷贝
text1.getChars(0,text1.length(),chars,0);
//参数一 参数二 拷贝String中字符的范围
//参数三 目标字符数组
//参数四 目标字符数组中的存储起始位置
public void getChars(int srcBegin, int srcEnd, char dst[], int dstBegin) {
if (srcBegin < 0) {
throw new StringIndexOutOfBoundsException(srcBegin);
}
if (srcEnd > value.length) {
throw new StringIndexOutOfBoundsException(srcEnd);
}
if (srcBegin > srcEnd) {
throw new StringIndexOutOfBoundsException(srcEnd - srcBegin);
}
System.arraycopy(value, srcBegin, dst, dstBegin, srcEnd - srcBegin);
}public static native void arraycopy(Object src, int srcPos,
Object dest, int destPos,
int length);
| 欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |