Java regex to replace file path based on OS

前端 未结 3 1099
没有蜡笔的小新
没有蜡笔的小新 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:46

    Use the "file.separator" system property and base your regexp on that.

    http://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html

    Also see this: File.separator vs FileSystem.getSeparator() vs System.getProperty("file.separator")?

提交回复
热议问题