将数组行复制到另一个数组 [英] copy array line to another array

查看:165
本文介绍了将数组行复制到另一个数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个像
的数组
源数组:
column1 column2 column3
aaa xyz 35
bbb xyz 45
ccc klm 30

我想在数组中循环,然后逐行复制到column2值为xyz的另一个数组.
结果必须像这样

目标数组:
column1 column2 column3
aaa xyz 35
bbb xyz 45


您能帮我如何在VB.NET中对其进行编码吗?

谢谢,

Hi ,

I have an array like

source array :
column1 column2 column3
aaa xyz 35
bbb xyz 45
ccc klm 30

I want to loop in array and then copy line-by-line to another array where the column2 value is xyz.

The result must be like this

destination array :
column1 column2 column3
aaa xyz 35
bbb xyz 45


Could you please help me how to code it in VB.NET?

Thanks ,

推荐答案

创建一个新数组,将其设置为当前数组的计数.
然后,在当前数组上运行循环.
使用if条件仅选择其中包含xyz的值,然后将其重新分配给新值.

如果要更精确,请使用相同的if条件和计数器在当前数组上运行循环,获取第二个值为xyz的元素的计数,然后使用此计数器创建一个新数组.
Create a new array setting it to the count of the current array.
Then, run a loop on the current array.
Using an if condition select only values that have xyz in them and then reassign them to the new one.

If you want to be more precise, run a loop on the current array, using the same if condition and a counter, get the count of those elements whose second value is xyz and then create a new array using this counter.


我的真实数组的列太多..> 100.
有什么简单的方法可以复制匹配相应字段的行.

非常感谢.
my real array has too many columns .. >100.
is there any easy way to copy line matching corresponding fields .

thank you very much .


这篇关于将数组行复制到另一个数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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