homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
Forum Library, Charter, Moderators: ocean10000

Microsoft IIS Web Server and ASP.NET Forum

separating text - looking for function

 6:30 pm on Sep 15, 2010 (gmt 0)

I'm trying to separate text with a vb function, but I'm not really sure what to use.
Here's an example of the format of the text:

The length of the substrings between the underscores can be of varying length.
I would like to have the text up to the first underscore as the first substring, the next as the 2nd, the next as the 3rd.
Aside from the split function, are there other options?

Many thanks!



 6:51 pm on Sep 15, 2010 (gmt 0)

The split function would be your best option here, why would you want to use something else?


 7:20 pm on Sep 15, 2010 (gmt 0)

Thanks - I was reading that it was only released with VB 6, so not with older versions. Is that correct?

Here's the link
[vbexplorer.com ]


 7:47 pm on Sep 15, 2010 (gmt 0)

Perhaps more specifically what I need is some way to assign the different substrings to variables. I see on the SPLIT function that you can set the delimiter, count, and compare, but getting each distinct substring is a mystery.


 7:18 am on Sep 16, 2010 (gmt 0)

Here is some example code.

' The string to split
Dim myString As String = "Impnum_I1._a."

' Split the string
Dim splitString As String() = myString.Split("_")

' Iterate through the string collection
For Each s As String In splitString

' Get number (count) of seperate strings
Dim splitCount As Integer = splitString.Length

' Iterate by using splitCount
For i As Integer = 0 To splitCount - 1

' Or get the strings one by one manually
Dim firstString As String = splitString(0)
Dim secondString As String = splitString(1)
Dim thirdString As String = splitString(2)

Global Options:
 top home search open messages active posts  

Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved