开发者

Technique to truncate vbscript variables

开发者 https://www.devze.com 2023-03-06 21:11 出处:网络
I need to take zip codes of various lengths from an existing variable and truncate them, when appropriate, to 5 characters.

I need to take zip codes of various lengths from an existing variable and truncate them, when appropriate, to 5 characters.

Will this code work? If not, how can I accomplish this?

StateZip = split(splitAddr(1), " ")
S开发者_运维技巧tateZip = left(StateZip, 5)


splitAddr = "123456 12345 1234"
StateZip = split(splitAddr," ") 
For i = LBound(StateZip) To UBound(StateZip)
    StateZip(i) = left(StateZip(i), 5) 
    WScript.Echo StateZip(i)
Next
0

精彩评论

暂无评论...
验证码 换一张
取 消