Don't we have some sort of "dump" function?

  • Thread starter Thread starter Bill
  • Start date Start date
B

Bill

I have a few simple character strings that
won't "Trim", leaving me to believe that
there are some kind of un-printable trailing
characters of some sort. I need some sort
of dump function like:

HexDump("Bill") would yield the string:

C2899393

Any ideas?

Thanks,
Bill
 
Bill said:
I have a few simple character strings that
won't "Trim", leaving me to believe that
there are some kind of un-printable trailing
characters of some sort. I need some sort
of dump function like:

HexDump("Bill") would yield the string:

C2899393


In the immediate window:

For k = 1 To Len(s):Debug.Print Hex(Asc(Mid(s,k)));:Next
 
Bill said:
I have a few simple character strings that
won't "Trim", leaving me to believe that
there are some kind of un-printable trailing
characters of some sort. I need some sort
of dump function like:

HexDump("Bill") would yield the string:

C2899393

Are you using EBCDIC?

Write one!

Function HexDump(a As String) As String
Dim Temp As String
For I = 1 To Len(a)
Temp = Temp & Hex(Asc(Mid(a, I, 1)))
Next I
HexDump = Temp
End Function

print hexdump("Bill")
42696C6C

Tom Lake
 
The "offending" characters are hex A0, which is
ASCI 160, which is a "space". Why in the world
wouldn't the Trim function trim those off?
Bill
 
Thanks Tom, in my attempts to write one, I
left out the ASC portion of the expression,
which, of course left me with an invalid
expression.

Bill
 
The "offending" characters are hex A0, which is
ASCI 160, which is a "space". Why in the world
wouldn't the Trim function trim those off?

Trim() trims off ASCII 32 (hex 20). You could run a Query using Replace:

UPDATE table
SET fieldname = Replace([fieldname], Chr(160), "")

Test and back up first of course!

John W. Vinson [MVP]
 
Thanks John,
That's essentially what I did. Odd that the "offending"
strings were entered via text boxes on a form. And,
I have no idea how it was that so many "blanks" were
appended and why it would be that Access inserted
the Hex A0 versus a Hex 20.

There must have been 25 or 30 such strings in the
backend database.

Bill


John W. Vinson said:
The "offending" characters are hex A0, which is
ASCI 160, which is a "space". Why in the world
wouldn't the Trim function trim those off?

Trim() trims off ASCII 32 (hex 20). You could run a Query using Replace:

UPDATE table
SET fieldname = Replace([fieldname], Chr(160), "")

Test and back up first of course!

John W. Vinson [MVP]
 
Thanks John,
That's essentially what I did. Odd that the "offending"
strings were entered via text boxes on a form. And,
I have no idea how it was that so many "blanks" were
appended and why it would be that Access inserted
the Hex A0 versus a Hex 20.

There must have been 25 or 30 such strings in the
backend database.

It's possible that the user who inserted the text did so by copying and
pasting from Word or from Wordpad, and that the original document had "non
breaking spaces" - I believe that I recall that A0 is used for a blank that
Word won't wrap at the end of a line.


John W. Vinson [MVP]
 
We'll never know, but for sure I'll be on the lookout for
more of that kind of stuff in the future......SIGH!

Bill
 
It's possible that the user who inserted the text did so by copying and
pasting from Word or from Wordpad, and that the original document had "non
breaking spaces" - I believe that I recall that A0 is used for a blank
that
Word won't wrap at the end of a line.

Hi John

Looks like you're right. Open Character Map and hover over entry A0 (5th
row, just right of middle) and the tooltip says 'No-break space'.
 
Back
Top