数组和分隔符 [英] Array and Delimiters

查看:116
本文介绍了数组和分隔符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法编写代码将数组转换为分隔符。

Dim splitout As String

splitout = Join(DataArray(rows,列),"


行和列是整数,表示

数据集的行和列数量。


有人可以帮助显示我做错了什么吗?

当我将splitout写入文本文件时,没有任何内容。

解决方案
"和平" <它的世界尽头我们知道 it@here.com > schrieb

我在编写代码时将数组转换为分隔的
字符串。

Dim splitout As String
splitout = Join(DataArray(行,列),"

行和列是整数,表示数据集的行和列数量。

有人可以帮我们说明我的意思做错了吗?
当我把splitout写到文本文件时什么都没有。




如何声明DataArray?它必须是一个二维数组的

一维字符串数组。


如果DataArray是一个字符串数组,你可以写

splitout = Join(DataArray,"")

您还可以使用共享方法System.String.Join。


-

Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html


对不起最初没有完成。


rows = dsreportscopy.Tables(0).Rows.Count

columns = dsreportscopy.Tables(0).Columns.Count


Dim DataArray(行,列)作为对象

对于c = 0到列 - 1

DataArray(r,c )=

dsreportscopy.Tables(0).Columns.Item(c).ColumnName)

对于r = 0到行 - 1

DataArray(r,c)= dsreportscopy.Tables(0).Rows(r).Item(c))

下一步
下一页


Dim splitout As String

splitout = Join(DataArray(rows,columns)," ")

" Armin Zingler" < AZ ******* @ freenet.de>在消息中写道

news:eX ************** @ TK2MSFTNGP11.phx.gbl ...

" Peace" <它的世界尽头我们知道 it@here.com > schrieb

我在编写代码时将数组转换为分隔的
字符串。

Dim splitout As String
splitout = Join(DataArray(行,列),"

行和列是整数,表示数据集的行和列数量。

有人可以帮我们说明我的意思做错了吗?
当我把splitout写到文本文件时什么都没有。



DataArray是如何声明的?它必须是一维的一维字符串数组的数组。

如果DataArray是一个字符串数组,你可以写
splitout = Join(DataArray,& ;")

你也可以使用共享方法System.String.Join。

-
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html



" Peace" <它的世界尽头我们知道 it@here.com > schrieb

我很抱歉最初没有完成。

rows = dsreportscopy.Tables(0).Rows.Count
columns = dsreportscopy.Tables(0) .Columns.Count

Dim DataArray(行,列)作为对象
对于c = 0到列 - 1
DataArray(r,c)=
dsreportscopy。表(0).Columns.Item(c).ColumnName)
对于r = 0到行 - 1
DataArray(r,c)=
dsreportscopy.Tables(0).Rows( r).Item(c))
下一页

Dim splitout As String
splitout = Join(DataArray(rows,columns),"")




为什么第一个

DataArray(r,c)=

声明?它在循环之外使用''r''。

你想如何连接dataTable内容?每个

列和每个记录的新行之间有一个空格?你想怎么把价值

换成一个字符串?

-

Armin

<一个rel =nofollowhref =http://www.plig.net/nnq/nquote.html\"target =_ blank> http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html


I am having trouble writing code to turn an array into a delimited string.

Dim splitout As String
splitout = Join(DataArray(rows, columns), " ")

rows and columns are integers representing rows and columns quanitity of
datasets.

Could someone help show what I am doing wrong?
When ever I write splitout to to a text file nothing is there.

解决方案

"Peace" <Its the end of the world as we know it@here.com> schrieb

I am having trouble writing code to turn an array into a delimited
string.

Dim splitout As String
splitout = Join(DataArray(rows, columns), " ")

rows and columns are integers representing rows and columns quanitity
of datasets.

Could someone help show what I am doing wrong?
When ever I write splitout to to a text file nothing is there.



How is DataArray declared? It would have to be a 2-dimensional array of
1-dimensional string arrays.

If DataArray is a string array, you can write
splitout = Join(DataArray, " ")

You can also use the shared method System.String.Join.

--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html


I am sorry for not being complete originally.

rows = dsreportscopy.Tables(0).Rows.Count
columns = dsreportscopy.Tables(0).Columns.Count

Dim DataArray(rows, columns) As Object
For c = 0 To columns - 1
DataArray(r, c) =
dsreportscopy.Tables(0).Columns.Item(c).ColumnName )
For r = 0 To rows - 1
DataArray(r, c) = dsreportscopy.Tables(0).Rows(r).Item(c))
Next
Next

Dim splitout As String
splitout = Join(DataArray(rows, columns), " ")
"Armin Zingler" <az*******@freenet.de> wrote in message
news:eX**************@TK2MSFTNGP11.phx.gbl...

"Peace" <Its the end of the world as we know it@here.com> schrieb

I am having trouble writing code to turn an array into a delimited
string.

Dim splitout As String
splitout = Join(DataArray(rows, columns), " ")

rows and columns are integers representing rows and columns quanitity
of datasets.

Could someone help show what I am doing wrong?
When ever I write splitout to to a text file nothing is there.



How is DataArray declared? It would have to be a 2-dimensional array of
1-dimensional string arrays.

If DataArray is a string array, you can write
splitout = Join(DataArray, " ")

You can also use the shared method System.String.Join.

--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html



"Peace" <Its the end of the world as we know it@here.com> schrieb

I am sorry for not being complete originally.

rows = dsreportscopy.Tables(0).Rows.Count
columns = dsreportscopy.Tables(0).Columns.Count

Dim DataArray(rows, columns) As Object
For c = 0 To columns - 1
DataArray(r, c) =
dsreportscopy.Tables(0).Columns.Item(c).ColumnName )
For r = 0 To rows - 1
DataArray(r, c) =
dsreportscopy.Tables(0).Rows(r).Item(c))
Next
Next

Dim splitout As String
splitout = Join(DataArray(rows, columns), " ")



Why the first
DataArray(r, c) =
statement? It is outside the loop that uses ''r''.
How do you want to concatenate the dataTable content? One space between each
column and a new line for each record? How do you want to convert the values
to a string?
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html


这篇关于数组和分隔符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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