Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8052383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:31:55+00:00 2026-06-05T07:31:55+00:00

I am parsing a CSV file into an array. One element of array is

  • 0

I am parsing a CSV file into an array. One element of array is .0000 I want to parse this as 0 but when I tried to parse .0000 using following methods it returns 1

fields[38].Substring(0,fields[38].IndexOf("."))  // expected 0, return 1

Convert.ToDecimal(fields[38])  // expected 0.00, return Exception

string.Equals(fields[38],".0000")   // expected true, return false

(int)decimal.Parse(fields[38])     // expected 0, return 1

Help Please !!!!!!!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T07:31:56+00:00Added an answer on June 5, 2026 at 7:31 am

    This works, not sure if there’s an easier way:

    (int)(Decimal.Parse(val, System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture));
    

    Decimal.Parse Method (String, NumberStyles, IFormatProvider)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicates: Fast CSV parsing How to properly parse CSV file to 2d Array?
I have a large nested array that I'm generating from parsing a CSV file
Having a problem with parsing a CSV file. I connect to the file using
I've been given a large file with a funny CSV format to parse into
I'm parsing a CSV file that looks like this: E1,E2,E7,E8,,, E2,E1,E3,,,, E3,E2,E8,,, E4,E5,E8,E11,,, I
I'm parsing a list of patient visits (csv file). To deal with this, I
I am parsing a mustache file into a string, and after that I want
Task 1: Read each row from one csv file into one seprate txt file.
I want to make sure a CSV file uploaded by one of our clients
I'm trying to create a simple Silverlight application that involves parsing a CSV file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.