asked on # How to strip off numbers after the first decimal place?

Hi

Here are the decimal:

1600.15

200.46

12.89

How can I strip off the 2nd decimal place to make those decimal to be:

1600.1

200.4

12.8

I have the following code to return bool if it is more than one decimal place.

But, how can I strip off and return the one decimal place number in VC#?

Here are the decimal:

1600.15

200.46

12.89

How can I strip off the 2nd decimal place to make those decimal to be:

1600.1

200.4

12.8

I have the following code to return bool if it is more than one decimal place.

But, how can I strip off and return the one decimal place number in VC#?

```
public bool CheckDecimal(string number)
{
bool isValid = true;
if (number.Substring(number.Length - 1, 1) != ".")
{
isValid = false;
}
}
```

.NET ProgrammingASP.NET

I just realized that you are the previous asker...You accepted the solution in the other thread and the question seems nearly identical....was there an issue with what was posted and selected as the answer in the other thread?

Math.Round(123,1)

View this solution by signing up for a free trial.

Members can start a 7-Day free trial and enjoy unlimited access to the platform.

may i ask what does if (pos < 0) mean?

That if statement is to check if the '.' character was not found in number, which means the number has no decimal points at all.

Credit to the original poster...