-- Kopfzeile heading :: String heading = ljustify 12 "Name" ++ rjustify 4 "Mark" ++ rjustify 6 "Rank" -- Ein Ergebnistupel in einen String umwandeln (Name linksbündig 12 Zeichen, Note 4 Zeichen rechtsbündig, Rang 6 Zeichen rechtsbündig line :: (Name,Mark,Rank) -> String line (xn,xm,xr) = ljustify 12 xn ++ rjustify 4 (show xm) ++ rjustify 6 (show xr) -- rechts- bzw. linksbündiges Ausrichten von Strings ljustify, rjustify :: Int -> String -> String ljustify n xs = xs ++ spaces (n - length xs) rjustify n xs = spaces (n - length xs) ++ xs spaces x = replicate x ' '