| | |
ASP - Finding a Specific Number in an Integer
Please support our ASP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
Hi,
I about to write some code, that will, in the end, format some HTML.
To keep storage space down, the idea is to hold the number as an integer, and pick out the character that relates to the specific format when writing it. My problem however comes when trying to pick out the character.
The idea is to divide the number by a multiple of 10, and take the first number to the right of the decimal place, that way, if no formatting is t be applied, the integer can be 0, and each division will therefore also be 0, saving space in the database.
Can anybody help me with a way of finding the number to the left of the Decimal Place?
Thanks,
uniquestar
I about to write some code, that will, in the end, format some HTML.
To keep storage space down, the idea is to hold the number as an integer, and pick out the character that relates to the specific format when writing it. My problem however comes when trying to pick out the character.
The idea is to divide the number by a multiple of 10, and take the first number to the right of the decimal place, that way, if no formatting is t be applied, the integer can be 0, and each division will therefore also be 0, saving space in the database.
Can anybody help me with a way of finding the number to the left of the Decimal Place?
Thanks,
uniquestar
Tip of the Millenium: There is no point worrying about life, because no-one gets out alive.
Hi,
you can use the following logic.
suppose the number is 123.567
take 2 integer variables say a and b and 2 float variables say c and d.
now c=123.567
a = c
this will store integer part in a.
now do d = c-a
so d will have .567
and a will have 123
to get digits from a.
divide a with 10 each time and the reminder will be the digit.
to get digits from d
multiply d with 10 and each time you will get one digit.
I hope this will solve your problem.
you can use the following logic.
suppose the number is 123.567
take 2 integer variables say a and b and 2 float variables say c and d.
now c=123.567
a = c
this will store integer part in a.
now do d = c-a
so d will have .567
and a will have 123
to get digits from a.
divide a with 10 each time and the reminder will be the digit.
to get digits from d
multiply d with 10 and each time you will get one digit.
I hope this will solve your problem.
Vivek Rawat
Keep solving complexities.
Keep solving complexities.
![]() |
Other Threads in the ASP Forum
- Previous Thread: To write a text file in FTP server
- Next Thread: Where to run this ASP?
| Thread Tools | Search this Thread |
archive asp asp.net aspandmssqlserver2005 aspandmssqlserver2005connection aspconnection connection database databaseconnection dreamweaver excel fso iis msmsql mssql2005 mssqlserver2005 mssqlserver2005andasp mssqlserverandasp opentextfile record searchbox selectoption single specfic sqlserver sqlserverconnection windows7





