Navigation
Synopsis Center a string in given space.
Function
  1. str center(str s, int n)
  2. str center(str s, int n, str pad)
Usage import String;
Description
  1. Center string s in string of length n using spaces.
  2. Center string s in string of length n using pad as padding character.
Examples
rascal>import String;
ok
rascal>center("abc", 10);
str: "   abc    "
rascal>center("abc", 10, "x");
str: "xxxabcxxxx"
Is this page unclear, or have you spotted an error? Please add a comment below and help us to improve it. For all other questions and remarks, visit ask.rascal-mpl.org.