Como no puedo editar, actualizo la función.
Si algun moderador puede borrar el tema Función sSplit by Slek lo agradecería.
El code tenía unos pequeños vallos. Arreglados

Código: Seleccionar todo

Function sSplit(Str As String, Del As String) As String()
'Autor: Slek
'Fecha: 14/02/10
'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
 
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)
 
lRet = 1 - Cst
 
For i = 0 To UBound(Splitted) - 1
    nRet = InStr(lRet + Cst, Text1.Text, Del)
    Splitted(i) = Mid(Str, lRet + Cst, nRet - lRet - Cst)
    lRet = nRet
Next i
 
lRet = lRet - 1 + Cst
 
Splitted(lCont) = Right(Str, Len(Str) - lRet)
 
sSplit = Splitted
End Function
Ejemplo de su uso:

Código: Seleccionar todo

Dim Tmp() As String
Dim i as integer
 
Tmp = sSplit(Text1.Text, " ")
For i = 0 to Ubound(Tmp)
 msgbox tmp(i)
next i
Saludos y perdonen las molestias >.<
github.com/Slek-Z
Justamente, hace poco estaba buscando una alternativa nueva al split



Gracias por el code, ten por seguró que me será útil, y que lo usaré!




EDIT:

Lo estoy utilisando con un crypter, como de costumbre , y me tira error...

For i = 0 To UBound(Splitted) - 1
nRet = InStr(lRet + Cst, text1.text, Del)
Splitted(i) = Mid(Str, lRet + Cst, nRet - lRet - Cst)
lRet = nRet
Next i


Text1.text = Variable no definida

Entonces supuse, el text1 es lo que él cojió como ejemplo, y lo cambié por la variable
que contiene toda la info es decir, tmp() en tu ejemplo.

Pero me sige saltando lo mismo.. cuando la variable, está bien definida

Imagen

http://img844.imageshack.us/img844/8088/mujerrara.jpg
http://img715.imageshack.us/img715/5813/tigree.png
http://img830.imageshack.us/img830/6484/camaleon.png

http://img839.imageshack.us/img839/4944/tigrev2.jpg
http://img843.imageshack.us/img843/443/spidermanxn.png

http://www.youtube.com/watch?v=wHYYkciIKE0

Código: Seleccionar todo

Function sSplit(Str As String, Del As String) As String()
'Autor: Slek
'Fecha: 14/02/10
'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

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)

lRet = 1 - Cst

For i = 0 To UBound(Splitted) - 1
    nRet = InStr(lRet + Cst, Str, Del)
    Splitted(i) = Mid(Str, lRet + Cst, nRet - lRet - Cst)
    lRet = nRet
Next i

lRet = lRet - 1 + Cst

Splitted(lCont) = Right(Str, Len(Str) - lRet)

sSplit = Splitted
End Function
Jeje ahora si que va.
Hay que cambiar Text1.text por Str jeje.

Saludos!
github.com/Slek-Z
Bien, ahora si que funciona. Thank youu !
Imagen

http://img844.imageshack.us/img844/8088/mujerrara.jpg
http://img715.imageshack.us/img715/5813/tigree.png
http://img830.imageshack.us/img830/6484/camaleon.png

http://img839.imageshack.us/img839/4944/tigrev2.jpg
http://img843.imageshack.us/img843/443/spidermanxn.png

http://www.youtube.com/watch?v=wHYYkciIKE0
Responder

Volver a “Otros lenguajes”