[Javascript] thousand separator

Flavio Gomes flavio at economisa.com.br
Thu Jun 3 11:20:05 CDT 2004


VBScript does.. altought I never and don't intend to VBScript for while:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnclinic/html/scripting080999.asp

---
Flavio Gomes
flavio at economisa.com.br

Shawn Milo wrote:

>Interesting.  I didn't know that.  Well, I suppose
>that the user will have to take care of modifying
>the script in that case, because I don't know how,
>if it's even possible, to detect the regional 
>values.
>
>Is that something that can be harvested from the
>browser somehow, as the current UTC offset can be?
>
>Shawn
>
>
>----- Original Message -----
>From: "George Pitcher" <george.pitcher at ingenta.com>
>Date: Thu, 3 Jun 2004 14:18:03 +0100
>To: "[JavaScript List]" <javascript at LaTech.edu>
>Subject: RE: [Javascript] thousand separator
>
>  
>
>>Shawn,
>>
>>Not sure if it applies, but in Germany, for example, the thousands separator
>>is a dot and the decimal separator is a comma.
>>
>>Esperanto for ever!
>>
>>George in Oxford [period]
>>
>>    
>>
>>>-----Original Message-----
>>>From: javascript-bounces at LaTech.edu
>>>[mailto:javascript-bounces at LaTech.edu]On Behalf Of Shawn Milo
>>>Sent: 3 June 2004 1:07 pm
>>>To: [JavaScript List]
>>>Subject: Re: [Javascript] thousand separator
>>>
>>>
>>>Okay, I've jury-rigged a solution.
>>>It ain't pretty, but it works.
>>>
>>>I've just used a simplified regex
>>>and a 'while' loop.
>>>
>>>Suggestions welcome.
>>>
>>>Shawn
>>>
>>>      <script type="text/javascript">
>>>
>>>         function addCommas(someNum){
>>>
>>>            while (someNum.match(/^(.*\d)(\d{3}(\.|,|$).*$)/)){
>>>               someNum =
>>>someNum.replace(/^(.*\d)(\d{3}(\.|,|$).*$)/, '$1,$2');
>>>            }
>>>            return someNum;
>>>
>>>         }
>>>
>>>         alert(addCommas('6541684.23'));
>>>         alert(addCommas('1000.1'));
>>>         alert(addCommas('34562346346'));
>>>         alert(addCommas('3456345634563456'));
>>>         alert(addCommas('763773763567.342'));
>>>         alert(addCommas('123456.234'));
>>>
>>>      </script>
>>>
>>>
>>>
>>>
>>>
>>>
>>>----- Original Message -----
>>>From: "andy susanto" <andy78 at centrin.net.id>
>>>Date: Thu, 3 Jun 2004 07:36:03 +0700
>>>To: <javascript at LaTech.edu>
>>>Subject: [Javascript] thousand separator
>>>
>>>      
>>>
>>>>hai,
>>>>
>>>>is there any script that can formating number with thousand
>>>>        
>>>>
>>>separator ?,
>>>      
>>>
>>>>if not how to create that script ?
>>>>
>>>>TIA,
>>>>
>>>>andy
>>>>_______________________________________________
>>>>Javascript mailing list
>>>>Javascript at LaTech.edu
>>>>https://lists.LaTech.edu/mailman/listinfo/javascript
>>>>        
>>>>
>>>_______________________________________________
>>>Javascript mailing list
>>>Javascript at LaTech.edu
>>>https://lists.LaTech.edu/mailman/listinfo/javascript
>>>
>>>      
>>>
>>_______________________________________________
>>Javascript mailing list
>>Javascript at LaTech.edu
>>https://lists.LaTech.edu/mailman/listinfo/javascript
>>    
>>
>
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript
>  
>



More information about the Javascript mailing list