Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
A simple parse function which returns in an array ...
Author:
Gilles Manouvrier
E-mail:
Click to e-mail author
Website:
http://gmanouvrier.free.fr
Submitted:
1/12/2001
Version:
VB5
Compatibility:
VB5, VB6
Category:
String Manipulation
Views:
11331
A simple parse function which returns in an array all words between two delimiters.
Declarations:
'none
Code:
'in a form, put this dim rs() as string 'if you have a string like tom="this is 'a test ' in order to'test' 'the function syntaxe'll be 'rs=Delimiter(tom,"'","'") if you want to get everything between the "'" Private Function Delimiter(ByVal texte As String, ByVal delimiter1 As String, ByVal delimiter2 As String) As Variant 'fonction de récupération de chaine entre deux bornes délimitrices 'retour sous forme de tableau de string Dim interne() As String Dim cpt As Integer Dim Flag1 As Boolean Dim flag2 As Boolean ReDim Preserve interne(1) 'initialisation du tableau à 1 qte = 1 'le premier composant du tableau en sortie aura l'index 1 Do While cpt < Len(texte) cpt = cpt + 1 'ReDim Preserve interne(cpt + 1) As String Debug.Print Mid$(texte, cpt, 1) If Mid$(texte, cpt, 1) = delimiter1 And Not Flag1 Then Flag1 = True GoTo lenext End If If Mid$(texte, cpt, 1) = delimiter2 And Flag1 = True Then Flag1 = False flag2 = True qte = qte + 1 ReDim Preserve interne(qte + 1) GoTo lenext End If If Flag1 Then interne(qte) = interne(qte) & Mid$(texte, cpt, 1) lenext: Loop Delimiter = interne End Function
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement