Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
Solved

# Break big delimited string into little strings

Posted on 1999-07-06
Medium Priority
123 Views
I need to break a sting, delimited by ';' into little
strings to be put into elements on a struct.

The string looks like this 1;2;2;2;2 .......  can be up
to 50 elements long when extracted, but no element will be bigger than 1 character.

How is this easily acheived?

So easy in SQR, not so easy here
0
Question by:xbd
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 4

LVL 2

Accepted Solution

BeedleGuis earned 150 total points
ID: 1522289
dim strtemp as string, intPos as integer
dim colStrings as new collection
'get the first substring
strtemp = left(strmain,1)
'loop to get the rest
intPos = instr(intpos,strMain,";",vbtextcompare)
while intpos > 0
strtemp = mid(strMain,intpos+1,1)
wend

0

LVL 2

Expert Comment

ID: 1522290
oops . . my fault, should be this:

Dim strtemp As String, intPos As Integer, strmain As String
Dim colStrings As New Collection
'get the first substring
strtemp = Left(strmain, 1)
'loop to get the rest
intPos = InStr(intPos + 1, strmain, ";", vbTextCompare)
While intPos > 0
strtemp = Mid(strmain, intPos + 1, 1)
intPos = InStr(intPos + 1, strmain, ";", vbTextCompare)
Wend

where strmain is your delimited string
0

LVL 2

Expert Comment

ID: 1522291
0

LVL 3

Expert Comment

ID: 1522292
In VB6, you can use the Split command.

use : NewArray = Split(BigDelimitedString, DelimiterChar)

example : A = Split("20;30;40;50;60", ";")
0

LVL 2

Expert Comment

ID: 1522293
wow, you learn somthing every day  :-)
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
###### Suggested Courses
Course of the Month5 days, 7 hours left to enroll