Filter string extracted from a table row

I have a table, where I’m not able to extract just the cell of data that I need for whatever reason, and it looks like I’m only able to extract the entire row.

I only need the first cell of data containing a phone number. So I have a string, with all the data from the row.
How do I filter out just the phone number. It ends up looking something like this…


I just need the phone number in the front.


I mean… Other than turning it into an array and extracting the first 10 chars, is there anything easier, faster, and cleaner that I could do? Thanks.


If the data mentioned in your post “8015554444WIRELINE-IPOTS$0.00$0.00ABC506426456IL” is present in a single cell, without converting the data into an Array or anything, you could use String.substring method to get the first 10 characters. But the question that you will have to ask yourself is: “will the phone number be always 10 characters?” If it is stored as 801-555-4444, your logic will not work.

1 Like

How does String Select work? String.Select(Of TSource, TResult). How does this work. I’ve been curious for awhile if this method would help in situations like this?

Substring isn’t working for some reason. Like there is a lot of whitespace or something so I don’t know how many chars it is of white space ahead of the Telephone number. So any other ideas?

Numbers Match!” + Environment.NewLine +
"Entered TN: " + tn + Environment.NewLine +
"TN found: " + tnResult.ToString.Substring(0, 10)

Prints out:

Numbers Match!
Entered TN: 3346930279
TN found:


All that extra space after TN found is not supposed to be there… It doesn’t print that out when I print the entire row out. When I print the entire row it prints like,


Q1 : I overlooked a few things from the first post. You mentioned table, is the data coming from an excel file or something? Should we check why you can’t read just the first cell?

Q2: Assuming, you are OK to proceed with the entire row data - Is there data before 8015554444WIRELINE-IPOTS$0.00$0.00ABC506426456IL ?

Suggestion : Please trim the data first. Say data is stored in tnResult, then:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.