Help reading strings with Mid

Hello all,

For some reason, I am having trouble with reading a single character at the end of a string.

Dim B As Integer= Asc(Mid(tBuf, Blen,1))  'Check for terminating chars

The data stream that it is searching consists of mostly unprintable characters with hex values as:
3C 00 64 00 FB 00 0D
I am looking for confirmation of the last byte, ‘0D’

This data came in through the serial port.

Can anyone tell me what I am doing wrong?
Thanks,
Tim

Why not use:
right(tBuf,1)

Maybe look at AscB and MidB?

@Joseph,
Your answer fixed the problem. Im curious, how did you learn of those methods? In the documentation for Mid, there is no reference to MidB…

Thanks,

Tim

[quote=464214:@Tim Seyfarth]@Joseph,
Your answer fixed the problem. Im curious, how did you learn of those methods? In the documentation for Mid, there is no reference to MidB…

Thanks,

Tim[/quote]

Glad that worked. Just had the same problem many moons ago working with serial and stumbled on AscB and MidB - they are listed in the “See Also” section of the language references in their counterparts Asc and Mid (at the very bottom). Most of the string functions have byte equivalent methods. So the answer is: even this blind squirrel finds a acorn once in a while.