i have list of strings with varaible lenght in rich text box
for ex.: 01001001
100101110011
100111101011
00110...
i want to copy these strings to another text box by making fixed lenght.
if string length is less pad zeros to msb and limit string lenght to 10
if string length is more than 10 omit msb bits and limit string length to 10
finally i want the output as
0001001001
0101110011
0111101011
....
Thanks in advance
What I have tried:
Dim binString2 As String = (binString1.PadLeft(10, "0"c))
the above coding is padding zeros to left and making string length to 10 if string size is less than 10.
but same is not working if string lentgh is more than 10
it is dispalying as it is without limiting string length
for ex.:
if string is
01001001
it is outputing as 0001001001
but if string is
100101110011
it is outputing as 100101110011 same without limiting string length to 10.
i want it as 0101110011 (msb two bits should be removed)