在 vbscript 中带零的 Lpad [英] Lpad with zero's in vbscript

查看:35
本文介绍了在 vbscript 中带零的 Lpad的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用 0 向左填充一个字符串.输出字符串的长度应该是 7.这是我的代码:

I'm trying to pad a string with 0's to the left.The length of the output string should be 7. Here's my code :

inputstr = "38"
in = string(7 - Len(inputStr),0) & inputStr
msgbox in

我收到错误预期语句请帮我谢谢

I'm getting error Expected Statement Please help me Thank You

推荐答案

以下代码将运行速度提高 5%:

The following code will run 5% faster:

inputStr = "38"
result = Right("0000000" & inputStr, 7)

msgbox result

这篇关于在 vbscript 中带零的 Lpad的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆