Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
L

left-pad

> 编程语言
Open source

:arrow_left: String left pad -- deprecated, use String​.prototype​.pad​Start()

1.3K stars0 likes3 views
WebsiteGitHub

About

:arrow_left: String left pad -- deprecated, use String​.prototype​.pad​Start()

left-pad

String left pad

Build Status

Install

bash
$ npm install left-pad

Usage

javascript
const leftPad = require('left-pad')

leftPad('foo', 5)
// => "  foo"

leftPad('foobar', 6)
// => "foobar"

leftPad(1, 2, '0')
// => "01"

leftPad(17, 5, 0)
// => "00017"

NOTE: The third argument should be a single char. However the module doesn't throw an error if you supply more than one chars. See #28.

NOTE: Characters having code points outside of BMP plane are considered two distinct characters. See #58.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

JavaScriptleftleft-padleftpadpad

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言