本文介绍了你好,,,,在段落中的单词或术语之间如何间隔的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好
文本文件空间中的单词之间的空格的代码是什么= 20空白,请在vb.net2010
hello
what is the code for space between words in text file space =20 blank please answer in vb.net2010
推荐答案
Dim animals As String() = New String() {"Cat", "Dog", "Horse"}
Dim fruits As String() = New String() {"Apple", "Banana", "Grapes"}
Dim line As String
Dim sb As New StringBuilder()
Dim spaces As New String(" "C, 20)
Dim i As Integer = 0
While i < animals.Length AndAlso i < fruits.Length
'20 in {0,20}, defines the width of the column
'If it is negative i.e. -20, then the text is left aligned
'within the column otherwise it is right aligned in the column
'line = String.Format("{0,20}{1,20}" & vbLf, animals(i), fruits(i))
line = String.Format("{0,-20}{1,-20}" & vbLf, animals(i), fruits(i))
'If 20 spaces are to be introduced between two words then
'the following code can be used.
'line = String.Format("{0}{1}{2}" & vbLf, animals(i), spaces, fruits(i))
sb.Append(line)
i += 1
End While
System.IO.File.WriteAllText(fileName, sb.ToString())
这篇关于你好,,,,在段落中的单词或术语之间如何间隔的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!