Login | |
|
 |
RE: assignment error - 8/11/2006 2:31:20 AM
|
|
 |
|
| |
Country73
Posts: 716
Score: 8
Joined: 8/25/2004
From: USA
Status: offline
|
Something like this: myString = "ABCDEFGHIJKLMNOP" LenString = LEN(myString) 'this gives us the length of the string: 16 fString = LEFT(myString,2) 'this takes the first two characters of the string: AB lString = MID(myString,4,LenString) 'this takes the last portion of the string from character 4 to end: DEFGHIJKLMNOP newString = fString & "Z" & lString 'combine first two characters, our new character, last portion of original string MsgBox myString & vbcr & newString
< Message edited by Country73 -- 8/11/2006 2:34:38 AM >
|
|
| |
|
|
|
 |
RE: assignment error - 8/11/2006 3:37:39 AM
|
|
 |
|
| |
ebgreen
Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
|
Or to one line it: strTest = "This Is a String" WScript.Echo "BEFOR: " & strTest strResult = Left(strTest, 6) & Replace(strTest, Mid(strTest, 7, 1), "Z", 7, 1) WScript.Echo "AFTER: " & strResult
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
|
|