Split string with dot as delimiter

后端 未结 13 2206
死守一世寂寞
死守一世寂寞 2020-11-22 11:14

I am wondering if I am going about splitting a string on a . the right way? My code is:

String[] fn = filename.split(\".\");
return fn[0];


        
相关标签:
13条回答
  • 2020-11-22 12:20
    String str="1.2.3";
    String[] cats = str.split(Pattern.quote("."));
    
    0 讨论(0)
提交回复
热议问题