在做588. Design In-Memory File System时遇到 split 函数的坑。

 

1.  String[]  strs=  ”/a/b/c“.split("/") 得到的是 strs=   ["","a","b","c"] 四个字符串,所以应该忽略第一个空字符串

2.  String[]  strs=  ”/“.split("/") 得到的是 strs.length = 0 ,所以对 "/" 要单独处理

posted on 2019-02-09 02:44  KeepAC  阅读(100)  评论(0编辑  收藏  举报