计算用逗号分隔的数字整数

时间:2019-04-11 09:31:50

标签: vb.net

[![在此处输入图像描述] [1]] [1]这是显示我的字符的代码,用空格分隔。我怎样才能使代码用“,”分开

因此,如果您的行是25,16,300,则结果应为3。

TxtMReadOnly.Text = String.Join(Environment.NewLine, intersectionList)

TxtNumberListCount.Text &= Environment.NewLine & TxtMReadOnly.Text.Where(Function(x) Not Char.IsWhiteSpace(x)).Count()

我尝试的所有操作在以下屏幕截图中均不起作用。但是如果可以的话,以数字为例,如果是55,则应取为1。

第一:不起作用:仅适用于第一行,不适用于所有文本框行。

TxtNumberListCount.Text &= Environment.NewLine & TxtMReadOnly.Text.Split(",").Count()

第二:不能正确显示值。

TxtNumberListCount.Text &= Environment.NewLine & TxtMReadOnly.Text.Where(Function(x) Not x = ",").Count()

我编辑了帖子:

  For j = 0 To TxtCheckList.Text - 1
            Dim intersectionList As New List(Of String)()
            For i As Integer = 1 To TxtCheckDraws.Text
                Dim firstBoxList = TxtBoxIntDraws.Lines(i).Split(",")
                Dim secondBoxList = TxtNumberListScan.Lines(j + 1).Split(" ")
                intersectionList.Add(String.Join(",", secondBoxList.Intersect(firstBoxList)))
            Next
            TxtMReadOnly.Text = String.Join(Environment.NewLine, intersectionList)
            TxtNumberListCount.Text &= Environment.NewLine & TxtMReadOnly.Text.Where(Function(x) Not Char.IsWhiteSpace(x)).Count()
            Try

0 个答案:

没有答案