getChars的用法

来源:互联网 发布:openwrt ip mac绑定 编辑:程序博客网 时间:2024/06/08 17:47
<%@ page contentType="text/html; charset=gb2312" %><%@ page import="java.util.*" %><html>        <!--  getChars()方法的用法:              getChars()方法可以一次获得字符串中的多个字符。语法格式如下:              void getChars(int sourceStart,int sourceEnd,int target[],int targetStart);                            第一个参数sourceStart指出了字符串截取所开始的位置;                            第二个参数sourceEnd指出了字符串截取所结束的位置;                            第三个参数指出目标(即接收)字符数组;                            第四个参数指出目标字符数据接收的开始下标。                      --><body>    <%       String s="this is a student.";       int startPoistion=1;       int endPoistion=7;       char pointChars[]=new char[endPoistion-startPoistion];       s.getChars(startPoistion,endPoistion,pointChars,0);       out.println(pointChars);     %></body></html>

0 1
原创粉丝点击