Created
February 21, 2021 05:55
-
-
Save triacontane/05f6529456b42eee3766e4b2af03223f to your computer and use it in GitHub Desktop.
数値を指定桁数で半角スペース埋めします。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
'use strict'; | |
Number.prototype.padSpace = function(length){ | |
return String(this).padSpace(length); | |
}; | |
String.prototype.padSpace = function(length){ | |
var s = this; | |
while (s.length < length) { | |
s = ' ' + s; | |
} | |
return s; | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment