连接字符串路径 [英] concatenate string path

查看:83
本文介绍了连接字符串路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我有这样的字符串路径

字符串路径= @"\\ prespath \ pahtA \ pathB";

但是当我读到其他班级时,它会显示如下

object.AObj =路径;

路径显示"\\\\ prespath \\ pahtA \\ pathB"

如何使路径显示为"\\ prespath \ pahtA \ pathB"

谢谢,

Hello,

I have a string path like this

string path = @"\\prespath\pahtA\pathB";

however when I read it to other class it will show like this

object.AObj = path;

the path show "\\\\prespath\\pahtA\\pathB"

How can i make the path show "\\prespath\pahtA\pathB"

thanks,

推荐答案

也请注意,您可以使用path类来处理路径.它提供的功能可以节省大量时间,并可以最大程度地减少错误.
http://msdn.microsoft.com/en-us/library/system.io. path.aspx [^ ]
Also note that you can use the path class to work with paths. It provides functionality that will save you a lot of time and can minimize bugs.
http://msdn.microsoft.com/en-us/library/system.io.path.aspx[^]


路径. GetFullPath方法 [ ^ ]


路径显示"\\\\ prespath \\ pahtA \\ pathB"
没关系.继续执行和使用价值. "\"(反斜杠)是"\"的转义序列.您的路径已设定.别担心,这没错.

阅读:转义序列 [
path show "\\\\prespath\\pahtA\\pathB"
It''s ok. Go ahead with your implementation and use of the value. ''\'' (Backslash) is a escape sequence for ''\''. Your path is as you have set. Don''t worry, it''s not wrong.

Read: Escape Sequence[^]


这篇关于连接字符串路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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