码迷,mamicode.com
首页 > 编程语言 > 详细

java 字符串 操作

时间:2014-11-20 20:31:22      阅读:204      评论:0      收藏:0      [点我收藏+]

标签:sp   java   bs   as   new   nbsp   text   字符串   class   

截取逗号后字符  
String str = new String ("1,2,3,4,5,6");
      String[] str1 = str.split(",");
      System.out.println(str1[2]);//选择第3个元素
替换指定字符
String s = “abcat”;
    String s1 = s.replace(‘a’,‘1’);

java 字符串 操作

标签:sp   java   bs   as   new   nbsp   text   字符串   class   

原文地址:http://my.oschina.net/u/587105/blog/346910

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!