getChars的使用方法

<%@ 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>

原文地址:https://www.cnblogs.com/zfyouxi/p/5257724.html