
Código
Function sSplit(Str As String, Del As String) As String() 'Autor: Slek 'Fecha: 14/02/10 'Versión: 0.3 'Descripción: esta función simula Split de VB6 'Para Indetectables.net Dim lRet As Long, nRet As Long, i As Integer Dim lCont As Long, Cst As Long Dim Splitted() As String If Del = "" Or Str = "" Then Exit Function If InStr(1, Str, Del) = 0 Then Exit Function Str = Str & Del Cst = Len(Del) lRet = InStr(1, Str, Del) Do While lRet <> 0 lRet = InStr(lRet + Cst, Str, Del) lCont = lCont + 1 Loop ReDim Splitted(lCont - 1) lRet = 1 - Cst For i = 0 To UBound(Splitted) nRet = InStr(lRet + Cst, Str, Del) Splitted(i) = Mid(Str, lRet + Cst, nRet - lRet - Cst) lRet = nRet Next i sSplit = Splitted End Function
Ejemplo de su uso:
Código
Dim Tmp() As String Dim i as integer Tmp = sSplit(Text1.Text, " ") For i = 0 to Ubound(Tmp) msgbox tmp(i) next i