Java regex to replace file path based on OS

前端 未结 3 1122
没有蜡笔的小新
没有蜡笔的小新 2021-01-14 13:00

I\'m not very sure there is any regex to replace thoese things:

This is a string value read from a xml file saved through Linux machine



        
3条回答
  •  無奈伤痛
    2021-01-14 13:41

    This should take care of fixing slashes:

    String str = xml.replaceAll("\\\\|/", System.getProperty("file.separator"));
    

提交回复
热议问题