Jump to content
  • Advertisement

Archived

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

ELS1

Extracting a string with VB

This topic is 5919 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Next

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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!