Raised This Month: $ Target: $400
 0% 

Only display nums to right of decimal


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
johnjg75
Veteran Member
Join Date: Mar 2004
Location: Delaware
Old 09-08-2007 , 01:41   Re: Only display nums to right of decimal
Reply With Quote #2

PHP Code:
stock ExplodeStroutput[][], max_leninput[], delimiter )
{
    new 
nIdx 0nLen = (copycoutput[nIdx], max_leninputdelimiter ))
    while( 
nLen strlen(input) )
        
nLen += (copycoutput[++nIdx], max_leninput[nLen], delimiter ))
    return

-Then just make an output variable like numbers[2][10]
-Make the number to a string and put it in input and set max_len to the length of the number
- Set delimiter to '.'

It should look similar to this:
Code:
ExploadeStr(numbers,9,numbertoseparate,'.')
The string will be separated into two parts, the number before the decimal and the number after the decimal.
numbers[0] contains the numbers before the decimal
numbers[1] contains the numbers after the decimal

Then you can just convert the string back to a number if you need to.
__________________
johnjg75 is offline
Send a message via AIM to johnjg75 Send a message via MSN to johnjg75 Send a message via Yahoo to johnjg75
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:01.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode