If I put 12345, for example, in a "text" bar code's property, the output is 012345.
This "0" is the problem. How I can remove this?
I'm using Delphi 2010 and FastReport 4.9.72.
A Code 128C barcode needs to be an even number of digits. This is by design.
There is a 1:1 mapping between the numbers and the resulting output, and the output is 2-digit aligned. In the case of 1
the Code 128C representation of this number is 01
if the value was 12
then the underlying representation would be 12
so the digits 628
can only be represented by 0628
The wikipedia article about Code 128 explains the differences between the 128A, 128B and 128C encodings.
To remove leading zeros from a string:
function RemoveLeadingZeros(const S: String): String;
var
I, NumZeros: Integer;
begin
Len := 0;
for I := 1 to Length(S) do
begin
if S[I] <> '0' then Break;
Inc(NumZeros);
end;
if NumZeros > 0 then
Result := Copy(S, NumZeros+1, MaxInt)
else
Result := S:
end;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With