Return to Snippet

Revision: 29454
at July 29, 2010 22:20 by brunozepelini


Initial Code
Sub ClearArray(ByVal lst As ArrayList)
        Dim flag As Boolean = False

        For x As Integer = 0 To lst.Count - 1
            If x > lst.Count - 1 Then
                flag = True
            End If

            If x = lst.Count Then
                Exit For
            End If

            If String.IsNullOrEmpty(lst(x)) Or Regex.IsMatch(lst(x), "[\s]+") Then
                lst.RemoveAt(x)
                If Not flag Then
                    x = x - 1
                Else
                    x = x + 1
                End If
            End If
        Next
    End Sub

Initial URL

                                

Initial Description
I don\\\'t know if exist a easier way to do this. For me, works fine. =)

Initial Title
White space/Empty String trim function, for Arraylist class

Initial Tags

                                

Initial Language
VB.NET