首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >将零填充添加到字符串

将零填充添加到字符串
EN

Stack Overflow用户
提问于 2010-06-26 12:14:08
回答 5查看 191.9K关注 0票数 168

如何将"0“填充添加到字符串中,使字符串长度始终为4?

示例

代码语言:javascript
复制
If input "1", 3 padding is added = 0001
If input "25", 2 padding is added = 0025
If input "301", 1 padding is added = 0301
If input "4501", 0 padding is added = 4501
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3122677

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档