|
-
September 30th, 2004, 10:48 AM
#1
Replace Chr(32) or "*" with ""
Can't seem to get either one of these to work:
I want to replace all "*" with ""
Code:
a=replace(a,"*","")
a=replace(a,chr(42),"")
m=""
for i=1 to len(a)
t=mid(a,i,1)
if t<>"*" then m=m+t (tried chr(32) here also
next i
Two hours spent here...
Last edited by nbCathy; September 30th, 2004 at 10:51 AM.
Reason: used wrong code number or *
Cathy
Jan 2004 - NEWBIE to VB6
Any and all help appreciated
-
September 30th, 2004, 10:54 AM
#2
Re: Replace Chr(32) or "*" with ""
Hmmm ...
Dim TmpString As String
TmpString="ABCD*EFGH*JIKLM*NOPQR*STUV*WXYZ*"
TmpString=Replace(TmpString,"/*","")
Should work ... I think it may have to do with VB treating the "*" as a wildcard. Try escaping it.
-
September 30th, 2004, 11:30 AM
#3
Re: Replace Chr(32) or "*" with ""
Nope. didn't work. Seems as if Replace isn't replacing anything right now.
I'm sort of new. What do you mean by the "escaping it"
tks
Cathy
Jan 2004 - NEWBIE to VB6
Any and all help appreciated
-
September 30th, 2004, 11:44 AM
#4
Re: Replace Chr(32) or "*" with ""
Instead of doing it like this:
TmpString=Replace(TmpString,"/*","")
Do the same but skip the slash.
TmpString=Replace(TmpString,"*","")
This works for sure.
Regards,
Michael
-
September 30th, 2004, 11:49 AM
#5
Re: Replace Chr(32) or "*" with ""
 Originally Posted by MichaelNattfalk
Instead of doing it like this:
TmpString=Replace(TmpString,"/*","")
Do the same but skip the slash.
TmpString=Replace(TmpString,"*","")
This works for sure.
Regards,
Michael
Mike,
Replace works fine for me also ... Yaeh, the backslash was a bad idea ...
Cathy: Try recompiling your app and look to see if there are any invaid or missing references ...
-
September 30th, 2004, 12:04 PM
#6
Re: Replace Chr(32) or "*" with ""
I can make REPLACE work outside of this program.
I even have a lot of Replaces elsewhere in the code but
it just doesn't want to work at the place I have it.
????
Cathy
Jan 2004 - NEWBIE to VB6
Any and all help appreciated
-
September 30th, 2004, 12:16 PM
#7
Re: Replace Chr(32) or "*" with ""
I think I have found the problem but not exactly sure.
My replace was inside a WHILE statement and it affected
it somehow or another.
Thanks guys...
Cathy
Jan 2004 - NEWBIE to VB6
Any and all help appreciated
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|