RE: [PHP4BETA] Formatting numbers

[email protected] (=?windows-1250?Q?Mitja_=8Alenc?=) Wed, 31 May 2000 15:53:51 +0200
Newsgroups php.version4
Message-ID <316778BD9FB4D211B19C00105A3B19A43AD15D@PODROOM>
Well, almost. 
I probably shouldn't mention numbers, but strings in general.

How can I do the following:

"abcde" ==> "a:b:c:d:e"                as in func("abcde", ":", 1)
"abcdef" ==> "ab:cd:ef"                as in func("abcdef", ":", 2)
"abcdefgh" ==> "abcd:ef:gh"            as in func("abcdefgh", ":", -2, 2)

without serious substring()ing in awkward loops?
not to mention how much faster this is to do in C compared to PHP...


Mitja



-----Original Message-----
From: Adam Trachtenberg [mailto:[email protected]]
Sent: 31. maj 2000 15:34
To: Mitja Šlenc
Cc: [email protected]
Subject: Re: [PHP4BETA] Formatting numbers


number_format()

-adam

On Wed, 31 May 2000, [windows-1250] Mitja Šlenc wrote:

> Hi!
> 
> Is there a function for formatting numbers by inserting characters like ,
> and .?
> If there isn't, does someone feel like writing it? :)
> I have something like the following in mind:
> 
> str_format_number($number, $character, $every [, $maxnumber])

-- 
/ adam maccabee trachtenberg | visit college life online \
\ [email protected]           | http://www.student.com    /