|
-
Dec 10th, 2009, 11:12 AM
#1
Thread Starter
PowerPoster
[RESOLVED] get pieces of string
with vb6 + access
how can i extract the portion of a string separated by a "-"
symbol
like i want to
INSERT the each piece of string in to a table
for eg: from string "axb-bh-c22-dtr-egt-f" into a table
axb
bh
c22
dtr
egt
f
-
Dec 10th, 2009, 11:14 AM
#2
Re: get pieces of string
arrStrings = Split("axb-bh-c22-dtr-egt-f","-")
-
Dec 10th, 2009, 11:16 AM
#3
Thread Starter
PowerPoster
Re: get pieces of string
some more in detail please
-
Dec 10th, 2009, 11:22 AM
#4
Re: get pieces of string
You don't give me much to work with, but I'll give it a shot:
Code:
Dim i As Long
Dim arrStrings() As String
Dim strSQL as String
arrStrings = Split("axb-bh-c22-dtr-egt-f","-")
For i = 0 To Len(arrStrings)
strSQL = "INSERT INTO table_name (column_name) VALUES ('" & arrStrings(i) & ",)"
myDatabaseConnection.Execute(strSQL)
Next i
Basically just split your string by the delimiter, then iterate through the resulting array and insert each item into your database table.
-
Dec 10th, 2009, 11:28 AM
#5
Thread Starter
PowerPoster
Re: get pieces of string
thanks a lot
if delimiter is of multiple type like space or > then
is there any other function to evaluate it
-
Dec 10th, 2009, 12:16 PM
#6
Thread Starter
PowerPoster
Re: get pieces of string
thanks i used the replace function to make all unique
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|