Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

v6.0 - comma-delineated String Manipulation 1

Status
Not open for further replies.

Funkymatt

Programmer
Aug 27, 2002
101
US
A sample line from an imput file as follows:
1,123456,SL,27,1/30/2003,,1000.00

I already read in line by line with no problems into a String variable called TextLine.

1) I want to verify after the first comma IsNumeric() = True and Len()=6.

2) I want to verify that after the second comma is IsNumeric() = False and that Len()=2

3) I want to verify that after the 3rd comma IsNumeric() = True and that Len()=2

4) I want to verify that after the 4th comma IsDate() = True

Is there a way to do this in VB with ease? Is there a cool function that i'm missing out on for comma-delineated String Manipulation?

Best,
Funky
 
look up the Split() function and you're almost there!


________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
John, Thanks so much. I cannot believe I never knew that! Makes life easier on a Monday! :) Thanks again..and a star for your response time
 
You would be beter using a routine which "loads" the entire file into a single string, and 'parseing' the individual lines into an array -which can also use "Split" - with "vbCrLf" or vbNewLine" as the delimiter. Of course with trivial files you will not really notice hte difference, but The repetitive I/O operation of Line Input is highly inefficient, and larger files will be processed noticeably faster. I have posted a routine (?basGrabFile?) or something similar in these fora (VB / Ms. A) but it may (due to recent limitation on search capabiulity) not be readily available.




MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top