Click here to Skip to main content
15,849,325 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone.

I'm reading data from a datalogger and it gives me the bytes with left alignment.

I've been searching a function that allows me to align that bytes to the right.
For example: the number: 0110 1000 .
The result i want is: 0000 1101.

Thanks in advance.
Updated 19-Aug-13 0:35am
CPallini 19-Aug-13 5:43am    
It doesn't look an alignment operation. Are you sure your example is correct?

There is no "function" that can give you a result like that based on a single example - particularly when there is no obvious relationship between the input:
0110 1000
and the expected output:
0000 1110

I suggest that you look at the manual or datasheets for the datalogger and try to work out in better detail what the dat ait provides actually is...
Share this answer
CPallini 19-Aug-13 5:44am    
You and the OP have different expected outputs!
OriginalGriff 19-Aug-13 6:00am    
He changed his after seeing mine - I copy'n'pasted from his...:laugh:
Use like PadLeft function that might help you in this case
Share this answer
Acusu 19-Aug-13 6:53am    
Thanks, i converted it to string and back to byte.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900