Login | |
|
 |
RE: vbTextCompare & vbBinaryCompare - 5/30/2007 1:22:28 AM
|
|
 |
|
| |
ebgreen
Posts: 5250
Score: 31
Joined: 7/12/2005
Status: offline
|
try this: Option Explicit Dim strTest strTest = "1111 AAA BBB" strTest = Replace(Replace(strTest, " ", ",", 1, 1), " ", "-") WScript.Echo strTest
_____________________________
"... 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
|
|
| |
|
|
|
 |
RE: vbTextCompare & vbBinaryCompare - 5/30/2007 1:31:24 AM
|
|
 |
|
| |
ebgreen
Posts: 5250
Score: 31
Joined: 7/12/2005
Status: offline
|
To answer your question regarding the difference between the two comparison methods, essentially vbTextCompare is case insensitive while vbBinaryCompare (which is the default) is case sensitive.
_____________________________
"... 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
|
|
| |
|
|
|
 |
RE: vbTextCompare & vbBinaryCompare - 5/30/2007 1:45:33 AM
|
|
 |
|
| |
ebgreen
Posts: 5250
Score: 31
Joined: 7/12/2005
Status: offline
|
If you use the optional "Compare" parameter then you must use the optional "Start" parameter: Are you sure that every single entry in arrD has a space in it. If it does not have a space, then intFirstSpace will be set to 0 which is not valid.
_____________________________
"... 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
|
|
| |
|
|
|
 |
RE: vbTextCompare & vbBinaryCompare - 5/30/2007 2:02:05 AM
|
|
 |
|
| |
ebgreen
Posts: 5250
Score: 31
Joined: 7/12/2005
Status: offline
|
For the first replace, just tell it to start at the beginning and replace the firts space that it sees, so change these lines: intFirstSpace = InStr(entry," ") entry = Replace(entry," ",",",intFirstSpace,1) with this line: entry = Replace(entry," ",",",1,1)
_____________________________
"... 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
|
|
| |
|
|
|
|
|