I wrote this to help center by text in info boxes on my scripts and stuff but i find it useful maybe someone else will to.![]()
Code:program TextCenterToolbyDankness; // This Program will center text enter the longest string as Text1 then enter the shorter strings as text2 var Text1,Text2,Temp : String; O , C, D: Integer; begin Text1 := Readln('Enter The Longest String Here'); Text2 := Readln('Enter The Shorter String Here'); C := Length ( Text1 ) - Length ( Text2 ); D := C / 2; Writeln (' The Difference is : ' + IntToStr ( Length ( Text1 ) - Length ( Text2 ) ) ); Writeln (' Center Point is : ' + IntToStr (D ) ); Temp := ''; for O := 1 to d do Temp := Temp + Chr(32); Temp := Temp + Text2; for O:=1 to d do Temp := Temp + Chr(32); Writeln ( Text1 ); Writeln ( Temp ); end.





Reply With Quote






