Technique to truncate vbscript variables
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
精彩评论