Top Prev Next Up Down
RightC
Push the result to right. Because we are working with 21-bit
characters and all indexing is based on theese 21-bit characters.
function rightC(value:CFix;length:Integer;pad:CFix:=CFix_Space)
return CFix;
function rightC(value:String;length:Integer;pad:String:=" ")
return String;
function rightC(value:CVar;length:Integer;pad:CFix:=CFix_Space)
return CVar;
Examples:
001| v10:String:="1234567890";
002|
w:String:=(3=>'3',4=>'4',5=>'5');
003| x8:String:=" ABC ";
004| y14:String:="abcdefghijklmn";
005| y15:String:="abcdefghijklmnU";
006| z:String(1 .. 0);
[1] Ada.Text_IO.Put_Line (
"rightC(y14,10).>" & rightC(y14,10) & "<");
result: rightC(y14,10).>abcdefghij<
[2] Ada.Text_IO.Put_Line (
"rightC(y14,14).>" & rightC(y14,14) & "<");
result: rightC(y14,14).>abcdefghijklmn<
[3] Ada.Text_IO.Put_Line (
"rightC("""",10,"""").>" & rightC("",10,"") & "<");
result: rightC("",10,"").>����������<
[4] Ada.Text_IO.Put_Line (
"rightC(y14,15).>" & rightC(y14,15) & "<");
result: rightC(y14,15).>
abcdefghijklmn<
[5] Ada.Text_IO.Put_Line (
"rightC(y14,18,""! "").>" & rightC(y14,18,"! ") &
"<");
result: rightC(y14,18,"! ").>!
abcdefghijklmn<
The last unit in the pad maybe duplicated to get the
result length, in this case it is the space.
Store data in a way to keep the last unit of value as
the last unit.