Windows格式到Java格式的文件路径 [英] file path Windows format to java format

查看:416
本文介绍了Windows格式到Java格式的文件路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将Windows中的文件路径转换为C:\ Documents and Settings \ Manoj \ Desktop for Java,如C:/Documents and Settings/Manoj/Desktop.

I need to convert the file path in windows say C:\Documents and Settings\Manoj\Desktop for java as C:/Documents and Settings/Manoj/Desktop .

是否有任何实用程序可以进行这样的转换?

Is there any utility to convert like this.?

推荐答案

String path = "C:\\Documents and Settings\\Manoj\\Desktop";
path = path.replace("\\", "/");
// or
path = path.replaceAll("\\\\", "/");

文档中找到更多详细信息.

Find more details in the Docs

这篇关于Windows格式到Java格式的文件路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆