liqiliang1437
class Test09 {
    public static void main(String[] args) {
        String str = "www.baidu.com";
        String[] split = str.split(".");
        //System.out.println(split[0]);//ArrayIndexOutOfBoundsException;
        //split的是一个regex,是一个正则表达式。。。。。而”.“在正则表达式中表示所有
        String[] split = str.split("\\.");//转译一下就可以了
        System.out.println(split[0]);//www
        
    }
}

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-28
  • 2022-12-23
  • 2021-06-03
  • 2021-05-16
  • 2021-08-29
  • 2021-11-22
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案