I am trying to replace nothing with something. Here is an example:
VB Code:
Dim Test as String Test = "" Test = Replace(Test, "", "-", 1)
If I then message Test, it still comes back with nothing. Anyone have any ideas?
Printable View
I am trying to replace nothing with something. Here is an example:
VB Code:
Dim Test as String Test = "" Test = Replace(Test, "", "-", 1)
If I then message Test, it still comes back with nothing. Anyone have any ideas?
?? Just think about that for a minute...please....
You want to replace every occurance of "" with something (lets say "A" for our purpose).
Look at this string, and tell me where "" happens:
"Hello"
Well, it happens before H, so lets add our character there.
"AHello"
Now, after A, there is another ""
"AAHello"
Oh, look at that, another one:
"AAAHello"
It is a neverending loop.
Now if you are wanting to take a empty string, and put a character, just do this:
If Test = "" then
Test = "-"
End If
he was giving an example to replace the occurance, not the actual code. well hellswrath is right, "" is everywhere. but the loop is not everlasting. after "" there can't be another "" because the length of "" won't fit in the string.