12-28-2010 10:23 AM
I am converting a decimal string into the binary equivalent using the format into string function, just wondering if there is a way to left zero fill the results? For example I have 5 converted to 1001 but would like to have the output string as 00001001, thanks.
Solved! Go to Solution.
12-28-2010 10:28 AM
After the part you have accomplished (5 -> 1001), measure the length of the converted string and concatenate the desired number of zero characters at the beginning of the string.
Lynn
12-28-2010 10:30 AM
format string
%08b
Ben
12-28-2010 10:32 AM
thanks for the replies, changing the format specifier worked.
12-28-2010 10:33 AM
You wil use format into string function with format string "%08b". The zero tells to pad with zeros on left. The eight tells the number of digits and b convert to binay.
12-28-2010 10:37 AM
@svt4cobra6 wrote:
thanks for the replies, changing the format specifier worked.
Good.
BTW
5 ===> 101
9 ===> 1001
now Ifeel better.
Ben
12-28-2010 10:44 AM
yep thanks for the correction on the binary math!