第06章 接口 类库 字符串.pptVIP

  • 4
  • 0
  • 约1.61万字
  • 约 43页
  • 2017-11-17 发布于河南
  • 举报
第06章 接口 类库 字符串

* 字符串操作类 java.lang.String类—字符串/字符序列 字符串转变为数组 public byte[] getBytes() 将字符串转变为一个字节数组 public byte[] getBytes(String?charsetName) throws UnsupportedEncodingException 按特定的字符编码格式将字符串转变为一个字节数组 public char[] toCharArray() 将字符串转变为一个字符数组 * 字符串操作类 java.lang.String类—字符串/字符序列 方法举例 String s = java语言; char[] c = s.toCharArray(); System.out.println(c.length); byte[] b = s.getBytes(); System.out.println(b.length); b = s.getBytes(ISO8859-1); System.out.println(b.length); 运行结果: 6 8 6 中文Windows操作系统: 默认字符集 GB2312 其他系统: 默认字符

文档评论(0)

1亿VIP精品文档

相关文档