The string to center
Width of the field to center s in
The character to use for filling excess space in the field
The resulting center-justified string. The returned string is GC-allocated. To avoid GC allocation, use centerJustifier instead.
assert(center("hello", 7, 'X') == "XhelloX"); assert(center("hello", 2, 'X') == "hello"); assert(center("hello", 9, 'X') == "XXhelloXX");
Center s in a field width characters wide. fillChar is the character that will be used to fill up the space in the field that s doesn't fill.