Re: Move Decimal Point
| From: | Chris Wesley | Date: | Wed, 11 Dec 2002 17:59:57 +0000 |
| Subject: | Re: Move Decimal Point | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-127857@lists.php.net to get a copy of this message | ||
On Wed, 11 Dec 2002, Stephen wrote:
> I have a question. How would you move the decimal left or right,
> depending on if the number a user enters is negative or not, and then
> move it that many spaces? If needed, it would add zeros.
Math ... multiply & divide ... I assume you're using a base-10 number
system, so multiply or divide by 10 when your user's input indicates you
should do so.
> One other question. How would I find the first 0 of a repeating zero.
> Like 204,000. How would you find the 0 in the 4th column.
I have one for you first. Are you using this list to do your homework?
I've noticed that over the past couple days you've been asking
not-necessarily PHP questions, but /basic/ programming questions.
For your repeating zeors question, you'll have to make use of some string
functions or a regexp function. Look for a pattern of more than 1 zero.
g.luck,
~Chris