Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Dynamically convert a 4-digit or more number to include comma seperations

Participant ,
Jan 06, 2008 Jan 06, 2008

Copy link to clipboard

Copied

I know there's a way to do this but I can't seem to figure it out. How can I make sure when I'm representing a numeric object that it includes the comma after three digits? So that '1000' reads '1,000'?
TOPICS
Server side applications

Views

423
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 06, 2008 Jan 06, 2008

Copy link to clipboard

Copied

databell wrote:
> I know there's a way to do this but I can't seem to figure it out. How can I
> make sure when I'm representing a numeric object that it includes the comma
> after three digits? So that '1000' reads '1,000'?

When asking this sort of question, you should say which server
technology you're using. In PHP, it's done with number_format():

http://docs.php.net/manual/en/function.number-format.php

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 06, 2008 Jan 06, 2008

Copy link to clipboard

Copied

.oO(databell)

>I know there's a way to do this but I can't seem to figure it out. How can I
>make sure when I'm representing a numeric object that it includes the comma
>after three digits? So that '1000' reads '1,000'?

Which programming language?

Micha

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 06, 2008 Jan 06, 2008

Copy link to clipboard

Copied

LATEST
Found it!

You do something like this:
<?php echo number_format($row_rsRecordset['number'],0,'.',','); ?>

instead of:
<?php echo $row_rsRecordset['number']; ?>

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines