如何将一个值追加到阵列的每一行 [英] How to append a value to each row of the array

查看:198
本文介绍了如何将一个值追加到阵列的每一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如标题所暗示的,你可以对数组的每一行挂了价值?
比方说,我有有三个元素的数组。
每个元素(行)是由细胞中的下面的preparation形成的:

As the title suggests, you can hang a value for each row of the array? Let's say I have an array having three elements. Each element (row) is formed by the following preparation in the cells:

home, host, share

细胞总数= 2(因为阵列中部分0)。
您可以附加最后一个单元格,然后共享后,随意的值?
这显然​​对阵列的每一行。
以这样的方式,以具有例如

total cells = 2 (because of part 0 in the array). You can append the last cell, then after share, a value at will? This obviously for each row of the array. In such a way as to have, for example:

line [0] => home, host, share, 3
line [1] => home, host, share, 3
line [2] => home, host, share, 3

你怎么能这样做呢?
我要澄清的是阵列如此记载:

How can you do this? I want to clarify that the array is so stated:

Dim array As New List(Of String)

我不希望现在有与该是一个int ...

I wouldn't want that now there are no problems with the last value that is an int ...

推荐答案

*有比这更好的办法......看到Plutonix比如答案。

*There are much better approaches than this...see the answer by Plutonix for instance.

您可以将其追加到年底就好了,但INT将被转换为一个字符串

You can append it to the end just fine, but the int will be converted to a string:

    Dim data As New List(Of String)
    data.Add("home1, host1, share1")
    data.Add("home2, host2, share2")
    data.Add("home3, host3, share3")

    For i As Integer = 0 To data.Count - 1
        data(i) = data(i) & ", " & i.ToString
    Next

    For Each entry As String In data
        Debug.Print(entry)
    Next

这将会是你来将其转换回一个int,当你在未来的拆分串入其不同的部分。

It'd be up to you to convert it back to an int when you split that string into its different parts in the future.

这篇关于如何将一个值追加到阵列的每一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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