小白教程
所有教程
关于
Search
172.69.59.205
172.69.59.205
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Java string getchars”的源代码
本页内容
上一节:
Java_string_getbytes
下一节:
Java_string_hashcode
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)}}[[Category:java string|14]] = Java getChars() 方法 = [[java string|Java String类]] getChars() 方法将字符从字符串复制到目标字符数组。 === 语法 === <pre> public void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin) </pre> === 参数 === * '''srcBegin''' -- 字符串中要复制的第一个字符的索引。 * '''srcEnd''' -- 字符串中要复制的最后一个字符之后的索引。 * '''dst''' -- 目标数组。 * '''dstBegin''' -- 目标数组中的起始偏移量。 === 返回值 === 没有返回值,但会抛出 IndexOutOfBoundsException 异常。 == <pre> public class Test { public static void main(String args[]) { String Str1 = new String("www.xiaobai.wang"); char[] Str2 = new char[6]; try { Str1.getChars(4, 10, Str2, 0); System.out.print("拷贝的字符串为:" ); System.out.println(Str2 ); } catch( Exception ex) { System.out.println("触发异常..."); } } } </pre> 以上程序执行结果为: <pre> 拷贝的字符串为:xiaobai </pre> [[java string|Java String类]]
返回至“
Java string getchars
”。
上一节:
Java_string_getbytes
下一节:
Java_string_hashcode