Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'Dim nombre As String = "DTE(id_DTE)100.xyz(0001).xml"
        Dim nombre As String = "DTE(tipo_DTE)(folio).(x)xml"
        Dim x As New ArrayList
        Dim dato As String = ""
        Dim n As Integer = nombre.Length ' 28
        Dim j As Integer = 0
        Dim k As Integer = 0
        For i As Integer = 0 To nombre.Length - 1
            If nombre(i) = "(" Then
                For j = i To nombre.Length - 1
                    dato += nombre(j)
                    If nombre(j) = ")" Then
                        x.Add(dato)
                        dato = ""
                        i = j
                        Exit For
                    End If
                Next
            Else
                For k = i To nombre.Length - 1
                    If nombre(k) = "(" Then
                        x.Add(dato)
                        i = k - 1
                        dato = ""
                        Exit For
                    Else
                        dato += nombre(k)
                        i = k
                        If i = nombre.Length - 1 Then
                            x.Add(dato)
                            i = k
                            dato = ""
                            Exit For
                        End If
                    End If
                Next
            End If
        Next
        MessageBox.Show("!")
    End Sub
End Class
 
No hay comentarios.:
Publicar un comentario