Wycademy/src/Wycademy/Commands/Services/MonsterInfoService.cs
/// <summary>
/// Pads both sides of a string with spaces to get the requested total length.
/// </summary>
/// <param name="stringToPad">The string to pad.</param>
/// <param name="totalLength">The length of the returned string.</param>
/// <returns>string</returns>
Pads both sides of a string with spaces to get the requested total length.
Pads both sides of a string with spaces to get the requested total length .
private string PadCenter(string stringToPad, int totalLength)
        {
            int delta = totalLength - stringToPad.Length;
            int padLeft = delta / 2 + stringToPad.Length;
            return stringToPad.PadLeft(padLeft).PadRight(totalLength);
        }
private string PadCenter ( string stringToPad , int totalLength ) { int delta = totalLength - stringToPad . Length ; int padLeft = delta / 2 + stringToPad . Length ; return stringToPad . PadLeft ( padLeft ) . PadRight ( totalLength ) ; }
Pads both sides of a string with spaces to get the requested total length.
Pads both sides of a string with spaces to get the requested total length .
// Finds the total amount of spaces to pad. // PadLeft adds spaces to bump the character count up to the required length, // so this adds half of the total amount of spaces to add to the left.
None
stringToPad
string
The string to pad.
The string to pad .
totalLength
int
The length of the returned string.
The length of the returned string .