in reply to Re: Thousands separator - this is getting annoying
in thread Thousands separator - this is getting annoying

Thanks for the fast reply. Numbers are coming straight out of database in that form, so I don't get much choice in the matter! Will just regexp them as you suggest.
Cheers
Martin GK
  • Comment on Re: Re: Thousands separator - this is getting annoying

Replies are listed 'Best First'.
Re: Re: Re: Thousands separator - this is getting annoying
by AgentM (Curate) on Jan 16, 2001 at 23:11 UTC
    Why do who have a number field as a string in the db in the first place? You'll lose lots of db-side operations on numbers in this form.
    AgentM Systems nor Nasca Enterprises nor Bone::Easy nor Macperl is responsible for the comments made by AgentM. Remember, you can build any logical system with NOR.
Re: Re: Re: Thousands separator - this is getting annoying
by boo_radley (Parson) on Jan 16, 2001 at 23:50 UTC
    That doesn't make any sense, unless, as agentM suggest, your number field is represented internally as a string. While you might have some unusual reason for doing so, it's not a good idea.

    If possible, I'd put the burden of conversion on the database. Depending on what you're using, and how you're querying it, you might be able to use

    SELECT INT(field) FROM table

    -or-

    SELECT CONVERT(NUMERIC (10,2),field) FROM table

    good luck!

      That doesn't make any sense, unless, as agentM suggest, your number field is represented internally as a string.

      Actually, it's likely that the database is storing the numbers as numbers, but that the format used when a number is retrieved from the database specifies commas. For example, in Oracle SQL*PLUS:

      14:23:48 FOCX> desc mytable Name Null? Type ----------------------------------------- -------- ---------------- ID NUMBER(7) 14:23:56 DB> select id from mytable; Press <enter> to continue... ID ------- 1000 1001 14:23:59 DB> set numformat 999,990 14:24:06 DB> / Press <enter> to continue... ID -------- 1,000 1,001