0
点赞
收藏
分享

微信扫一扫

把文件路径转换成与操作系统相关的路径方式

A邱凌 2023-04-25 阅读 69


 

/**
     * 把文件路径转换成与操作系统相关的路径方式
     * 
     * @param path
     * @return
     */
    private String changeFilePath(String path)
    {
        String filePath = "";
        if (path.indexOf("/") != -1)
        {
            filePath = path.replace("/", File.separator);
        }
        else
        {
            filePath = path.replace("\\", File.separator);
        }
        return filePath;
    }

 

 

举报

相关推荐

0 条评论