- Home
·
- String Manipulation
·
- This procedure will decompose a string into chunks of a chosen lenght. You can also chose where to
This procedure will decompose a string into chunks of a chosen lenght. You can also chose where to
This procedure will decompose a string into chunks of a chosen lenght. You can also chose where to start in the string. Very handy for word
Rate This procedure will decompose a string into chunks of a chosen lenght. You can also chose where to
(1(1 Vote))
'L is the starting position in the string
'W is the string to decompose
'R is the lenght of the decomposed chunks of the string
'Example: PString 0,1,"Vincent" will give
'V
'i
'n
'c
'e
'n
't
'Example2: PString 0,2,"Vincent" will give
'Vi
'nc
'en
't
Dim dword()
On Error GoTo skip
'error handling
If Len(W) < L Then
lstword.AddItem " PSTRING ERROR, START POSITION > WORD LENGHT!"
Exit Sub
End If
Do While Len(W) Mod R <> 0 ' Si R est un facteur de W ( C'est requis )
W = W & " " ' Auguemente la longeur de W par 1
Loop
skip:
W = W & " " ' Auguemente la longeur de W par 1 un derniere fois
ReDim dword(R To (Len(W))) 'Définir les parametres du array ex: (1 to 12)
For L = R + L To (Len(W)) Step R ' Boucle qui auguemente par R (l'intervalle)
dword(L) = Right(Left(W, L), R) ' Ce qui décompose le mot ( Compliqué)
If L = Len(W) Then ' Si c'est la derniere partie du mot
RTrim (dword(L)) ' enlever les espaces a la fin de cette partie du mot
End If
lstword.AddItem dword(L) 'Montrer les décompositions
Text1.Text = dword(L)
Next L
End Sub
This procedure will decompose a string into chunks of a chosen lenght. You can also chose where to Comments
No comments yet — be the first to post one!
Post a Comment