Solved

How to parse without the dollar sign

Posted on 2006-10-20
3
306 Views
Last Modified: 2012-06-27
Hi,
I am trying to parse a data to a database using .csv file which works fine.
But I have one slight problem - how can I remove a $ sign to parse just a number and not the whole thing.

Record ID   Customer Name  Amount     Account No  
  1        ABG                    20.00       025621            
  2              RLP                     17.50       525122    

Thanks!


 Public Sub ParseFile()

    directory = "\\**\***\MyFolder\"

    FileName = "File" & theDate & ".csv"

    thefile = directory & FileName

   Try

       Dim dataline As String()
       Dim delimiter As String = ","
 
       Dim parser As TextFieldParser

            parser = My.Computer.FileSystem.OpenTextFieldParser(thefile)

            parser.Delimiters = New String() {","}

      While Not parser.EndOfData

      dataline = parser.ReadFields()

      Customer_Name = dataline(0)

      Amount = dataline(1)

      Account_No = dataline(2)

    If Account_No <> "ACCOUNT_NO" Then

       EnterData()

    Else

     'skip the line and go to the next line of data

    End If

 End While

      parser.Close()

      MsgBox("Process Complete.")

        Catch ex As Exception
            MsgBox(ex)
            Exit Sub

        End Try

    End Sub
0
Comment
Question by:avi4
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 63

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 17777319
Hi avi4;

Try this

    Amount = dataline(1).Replace("$"c, "")

Fernando
0
 

Author Comment

by:avi4
ID: 17788426
Thanks a lot!
0
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 17788723
Not a problem, glad I was able to help. ;=)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question