Click here to Skip to main content
15,890,399 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Hi all

I want to know whether a digit is decimal or int

i know in front end we can use indexof method but how to do ti in back end

datatype for the field is decimal but some rows contains 1.00 and others 1.50 i wnat to distinguish those fields

C#
if(DayTotal.IndexOf('0') >0)
{
   1.5
}
else
{
   1.00
}


how to make it in back end

Thanks in advance
Posted
Updated 18-Jun-11 7:24am
v2

1 solution

I'm sure many ways there. I give you an example using CHARINDEX with CASE
SQL
SELECT '123.45'
,CASE
WHEN CHARINDEX('.','123.45') > 0
THEN 'Decimal'
WHEN CHARINDEX('.','123.45') = 0
THEN 'Integer'
END AS ValueType
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900