用于将字符填充到字符串末尾的 Jquery 函数
是否有内置函数可以填充字符 n
次?
例如:
var myString = 'something';
var myCharToPad = '-';
var numTimesToPad = 5;
我期待 myString = 'something-----';
Is there a built in function to pad characters n
number of times?
Ex:
var myString = 'something';
var myCharToPad = '-';
var numTimesToPad = 5;
I am expecting myString = 'something-----';
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不,但这并不难:
No, but it's not hard:
不,但写一个很简单:
Nope, but it's trivial to write one:
这是一个重复的条目;您应该始终首先检查,如果没有人有答案,这几乎是不可能的[抱歉,但很可能您并不那么特别]然后发布...这甚至可以通过更快地解决问题来节省您的时间。
您可以在 这里!也在这个网站上。
This is a repeated entry; you should always check first and if nobody has an answer, which is almost impossible [sorry but chances are that you are not that special] then post... that even saves you time by solving your issue faster.
You can find my "almost" ultimate answer to the JS padding issue at here! also on this site.