javascript number_format(넘버포멧 콤마 찍기) > JavaScript

본문 바로가기
사이트 내 전체검색

JavaScript

javascript number_format(넘버포멧 콤마 찍기)

페이지 정보

profile_image
작성자 최고관리자
댓글 0건 조회 6,104회 작성일 21-02-10 17:35

본문

출처 : http://blog.naver.com/sch30217?Redirect=Log&logNo=150080597783


 function addCommas(nStr)
 {
        nStr += '';
        x = nStr.split('.');
        x1 = x[0];
        x2 = x.length > 1 ? '.' + x[1] : '';
        var rgx = /(\d+)(\d{3})/;
        while (rgx.test(x1)) {
                x1 = x1.replace(rgx, '$1' + ',' + '$2');
        }
        return x1 + x2;
 }
 document.write(addCommas("1000000"));
 //result : 10,000,000[출처] javascript number format(넘버포멧 콤마 찍기)
 |작성자 무지개똥

댓글목록

등록된 댓글이 없습니다.

회원로그인

회원가입

  • 게시물이 없습니다.

접속자집계

오늘
3,745
어제
4,449
최대
6,642
전체
885,307
contact : webmaster@beautipia.co.kr
Copyright © beautipia.co.kr. All rights reserved.