public static void main(String[] args) { String str="upload\media\201904\i4Qjz8E40xGQovUq-2CMi-HrBaUrGFZhv9konAyx0Yg.jpg"; String result=str.replaceAll("\\", "/"); System.out.println(result); }