Re: Replace function doesn't work properly
- From: "Jan Hyde (VB MVP)" <StellaDrinker@xxxxxxxxxxxxxxxxxxx>
- Date: Tue, 21 Oct 2008 10:17:05 +0100
Co <vonclausowitz@xxxxxxxxx>'s wild thoughts were released
on Tue, 21 Oct 2008 00:20:59 -0700 (PDT) bearing the
following fruit:
On 20 okt, 15:16, "Jeff Johnson" <i....@xxxxxxxxxxx> wrote:
"Co" <vonclausow...@xxxxxxxxx> wrote in message
news:649f8e98-e803-4639-9e69-0f82df0e6754@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I use the Replace function in a vb project but found out that it ain't
working properly.
I try to remove a space from a string using:
sStr = Replace(sStr, " ", "",1, -1)
I tried this, and with Chr(32) and also vbBinaryCompare.
The space stays in.
Any ideas what causes this?
Chr$(160) instead of a normal space.
All,
I created a function to check all the characters in the string and it
definitely comes up with a Chr(32).
Still the Replace function won't remove it.
Does it have to do with the fact that I use this in VBA Word office
2003?
Well that is a *VERY* important piece of information because
VB6 solutions won't always work in VBA.
However in this case it shouldn't make a difference.
Can you post the string here?
J
sFinalName = Replace(sFinalName, Chr(46) & Chr(32) & Chr(46), ".",
1, -1, vbTextCompare)
findchrs (sFinalName)
Public Function findchrs(str As String)
Dim i As Integer
Dim j As Integer
Dim sResult As String
i = 1
j = Len(str)
Do While i < j
sResult = sResult & Asc(Mid(str, i, 1)) & ","
i = i + 1
Loop
Debug.Print str
Debug.Print sResult
End Function
--
Jan Hyde (VB MVP)
https://mvp.support.microsoft.com/profile/Jan.Hyde
.
- References:
- Replace function doesn't work properly
- From: Co
- Re: Replace function doesn't work properly
- From: Jeff Johnson
- Re: Replace function doesn't work properly
- From: Co
- Replace function doesn't work properly
- Prev by Date: Re: Add a context menu item to Windows Explorer (Win98) with VB6?
- Next by Date: Re: DragDrop Outlook attachments to a listbox VB6
- Previous by thread: Re: Replace function doesn't work properly
- Next by thread: Re: Replace function doesn't work properly
- Index(es):
Relevant Pages
|