This topic is now archived and is closed to further replies.


Extracting a string with VB

Recommended Posts

im very rusty with VB...and im using VB3, not .NET this time..its something im working on for my brother...anyways, here is my problem. i have a random text string like this:
3(s''sdsdsd.s'''','''''', ''sds&wew'''''',22''SDdfd&dfdfd.ett''
i cant seem to figure out how to extract the text that has the ampersand(&) WITHIN the single quote...for example...the string that would be extracted from the previous example is: sds&wew and SDdfd&dfdfd.ett im going nuts! can anyone help?

Share this post

Link to post
Share on other sites
I don''t know if this will work in VB3 or not but you can give this a try.

Dim strValue As String
Dim colResults As Collection

strValue="3(s''sdsdsd.s'''','''''', ''sds&wew'''''',22''SDdfd&dfdfd.ett''"

aryValues = Split(strValue,"''")

For i=0 to UBOUND(aryValues)
if InStr(aryValues(i),"&")=0 then
colResults.Add aryValues(i)
end if

You then have the values that contain an "&" in the collection and can do with it what you need.

Share this post

Link to post
Share on other sites