正斜杠还是反斜杠? [英] Forward slash or backslash?
本文介绍了正斜杠还是反斜杠?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用正斜杠会使系统独立。为了简单,我坚持这一点。
考虑使用 java.io.File.separator
,如果您曾经显示过用户的路径。你宁愿不惊讶那些Windows用户。他们是一个跳动很多。
I am looking to write and read text files to and from (respectively) a directory different from that of my program. When I specify a directory to write to or read from, should I be using forward slashes or backslashes to identify a file path?
解决方案
Using forward slashes will make it system independent. I'd stick to that for simplicity.
Consider using java.io.File.separator
if you ever display the path to the user. You'd rather not surprise those Windows users. They're a jumpy lot.
这篇关于正斜杠还是反斜杠?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文