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 8150949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:12:56+00:00 2026-06-06T15:12:56+00:00

I am working with a decimal type in my application and have to submit

  • 0

I am working with a decimal type in my application and have to submit that value as a string to a legacy web service which accepts values as strings. Its a payment value, so:

1000 => “100000” (1000 dollars and 00 cents)
131.11 => “13111”

I thought I’d multiply by 100 initially but ran into some cases that don’t work as expected.

EDIT:
OK I will clarify:

decimal val = 145.99m;
Console.WriteLine((val * 100).ToString());

results in:

14599.00

but I really need 14599 without the decimal points, since the value the other side is expecting is 145 dollars and 99 cents.

I was thinking there may be a different way rather than doing something like String.Replace(“.00”, string.Empty) or is this the only way?

  • 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-06T15:12:59+00:00Added an answer on June 6, 2026 at 3:12 pm

    If you want it to be 0 decimal places, you can do myDecimal.ToString("0");.

    For example:

    decimal myDecimal = 25.99m;
    (myDecimal*100m).ToString("0"); // 2599
    

    While if your decimal had more decimal places:

    decimal myDecimal = 3.14159m;
    (myDecimal*100m).ToString("0"); // 314
    

    EDIT: If your decimal has extra decimal places, it performs an .5 away round. (in my experience, VS2008).

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

Sidebar

Related Questions

I have a DataTable that has a string type column filled with valid numeric
I have this regex working but now need to allow numbers without the decimal
I’m working on optimizing some of my queries and I have a query that
Background I, like scores of programmers before me, am working on an application that
I'm working on a type converter that looks for a Parse method on the
I am working on a VB6 application that uses an ADODB.Recordset object to dump
I am working on a legacy ASP application. I am attempting to insert a
In a database I'm working with, I have a field in a table that
I'm working with an application that has the following tables for storing IP address
I have to validate user input data and ensure a string value is convertible

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.