Drew Wutka
DWUTKA at Marlow.com
Sat Apr 12 15:50:25 CDT 2008
Hmmm, two ways I can think of. One: Dim strRecordLine() as array strRecordline=split(yourstringhere,"|") NumberOfSeperatorCharacters=UBound(strRecordline)+1 Two: Dim strTemp as String strTemp=Replace(yourstring,"|","") #ofCharacters=Len(yourstring)-len(strTemp) Drew -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Saturday, April 12, 2008 3:24 PM To: VBA Subject: [dba-VB] Count a character in a string I do a lot of CSV stuff. One of my file suppliers gives me files that throw an error when I try to import them and so I am writing tools to try and troubleshoot these files. I need to be able to count the times that the field separator character is contained in a line. The error I am getting says the line is too long but I have determined that is not the case. I suspect that perhaps the field separator character is in the line too often. So, if I have a line that looks like: asdf|qwert|zxcv|mnbv Other than just iterating through the string character by character, is there a way to get a count of the | character in the string? -- John W. Colby www.ColbyConsulting.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com The information contained in this transmission is intended only for the person or entity to which it is addressed and may contain II-VI Proprietary and/or II-VI Business Sensitive material. If you are not the intended recipient, please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy. You are notified that any review, retransmission, copying, disclosure, dissemination, or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited.