3
I’m not finding the answer p this question, simply what I want to know how to do is to remove empty positions from an array, for example:
var(0) = "Remover"
var(1) = ""
var(2) = "espaços"
var(3) = ""
var(4) = "em"
var(5) = ""
var(6) = "branco"
I want to remove the empty positions, which in this case would be var(1), var(3) and var(5),
Someone would know how to do that?
I was thinking about passing only non-empty fields to another array, but how could I do that?
I tried to do the following thing:
Dim teste() As String
Dim i1 As Integer = 1
Dim i2 As Integer = 0
Dim testesemespaco(500) As String
teste = html.Split()
While i1 < teste.Length
If teste(i1) <> "" Then
testesemespaco(i2) = teste(i1)
i2 = i2 + 1
End If
i1 = i1 + 1
End While
Cannot remove positions from a
array
, they have fixed size.– Jéf Bueno
Not even if you try to pass only positions that are not empty to another array?
– Matheus Menegatte
Then yes, but that would need to be explicit in the XD question
– Jéf Bueno
I’ll edit, kkkk
– Matheus Menegatte
Would you know how to do that? I’m trying but you’re not going
– Matheus Menegatte
I do. I’ll give you an answer
– Jéf Bueno
It is a string array?
– Jéf Bueno
yes, I will edit the question by putting my code that is not working
– Matheus Menegatte
Let me know if it works or not.
– Jéf Bueno
Error appeared, http://prntscr.com/feb7gl
– Matheus Menegatte
Missing one
.ToArray()
after Where. See my issue– Jéf Bueno
Now it’s gone, thanks a brother !!!
– Matheus Menegatte