Skip to content
ゼロ埋めライブラリ
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
demo
dist
src
test
.babelrc
.editorconfig
.eslintignore
.eslintrc.yml
.gitignore
LICENSE
README.md
bs-config.js
package-lock.json
package.json
rollup.config.js

README.md

Zero-padding

Zero padding for number at JavaScript

IE 9以上 IE Edge 最新版 Google Chrome 最新版 Mozilla Firefox 最新版 Safari 最新版 iOS 7以上 Android 4.4以上

Usage

html

<script src="dist/zero-padding.js"></script>

npm

Install to project

$ npm i -D zero-padding

Write to javascript files

import ZeroPadding from 'zero-padding'

Document

ZeroPadding(num, digit)

argument

param type description
num number number you want to zero padding in
digit number include digit number of zero padding

return

string

example

var num1 = ZeroPadding(10, 3)  //-> '010'
var num2 = ZeroPadding(-10, 5) //-> '-00010'
var num3 = ZeroPadding(100, 2) //-> '100' no zero padding
You can’t perform that action at this time.