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

问题描述

Dim sbdev As New StringBuilder()
sbdev.Append(CurDir())
sbdev.Append("\")
sbdev.Append(cFolder)
sbdev.Append("\") 


我如何在一项陈述中将其连接起来?


how can i concatenate this in one statment?

推荐答案

Dim sbdev As New StringBuilder()
sbdev.AppendFormat("{0}\{1}\", CurDir(), cFolder)



虽然,



Though,

System.IO.Path.Combine(CurDir(), cFolder)


可能更合适.


might be more appropriate.


Dim sbdev As New StringBuilder()
sbdev.Append(CurDir()) & "\" & cFolder & "\") 
sbdev.Append(systemDrive & "Program Files\")
sbdev.Append(systemDrive & "Windows\")


Dim sbDev as string = CurDir() & "\" & cfolder & "\"


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

09-21 12:37