Adding Characters to a string
From: Michael Bouchard (mbouchard_at_xNOSPAMx.ci.charlotte.nc.us)
Date: 06/30/04
- Next message: david cornwall: "enumerating user description in w2k3 AD"
- Previous message: xiao chun: "Re: The Association of *.vbs has been changed, how to restore?"
- Next in thread: Tom Lavedas: "RE: Adding Characters to a string"
- Reply: Tom Lavedas: "RE: Adding Characters to a string"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 30 Jun 2004 10:24:20 -0400
I am prompting technicians for a serial number at the begining of an install
and wanted to try to make sure that the serial number was formated
correctly.
The script below works but I am just wondering if there is a better way to
add the - to the string
Thanks,
Mike
CheckString = "565495423564898562124165"
If Len(CheckString) <> 29 then
If Len(CheckString) = 24 then
MyVar = Mid(CheckString,1,4)
MyVar = MyVar & "-" & Mid(CheckString,5,4)
MyVar = MyVar & "-" & Mid(CheckString,9,4)
MyVar = MyVar & "-" & Mid(CheckString,13,4)
MyVar = MyVar & "-" & Mid(CheckString,17,4)
MyVar = MyVar & "-" & Mid(CheckString,21,4)
Msgbox MyVar & vbcr & "5654-9542-3564-8985-6212-4165"
Else
'Something here
End If
Else
'Something here
End if
- Next message: david cornwall: "enumerating user description in w2k3 AD"
- Previous message: xiao chun: "Re: The Association of *.vbs has been changed, how to restore?"
- Next in thread: Tom Lavedas: "RE: Adding Characters to a string"
- Reply: Tom Lavedas: "RE: Adding Characters to a string"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|