private function _charpad($string, $length, $direction, $filler = ' ')
    {

        // Keep length of string handy here
        $strlen = strlen($string);

        // Difference between max length and string length
        $difference = $length - $strlen;

        // If the string length is bigger than the max, just return string truncated to the max length
        if ($difference < 0) {
            return substr($string, 0, $length);
        }

        // Deal with direction
        switch ($direction) {

            // Right aligned (padded to the left)
            case 'r':
                return str_repeat($filler, $difference - 2).$string;
            break;

            // Left aligned (padded to the right)
            case 'l':
                return $string.str_repeat($filler, $difference - 2);
            break;

            // Centered (padded left and right)
            case 'c':
                $cdiff = floor($difference / 2) - ($difference % 2 == 0 ? 1 : 0);

                return str_repeat($filler, $cdiff - 1).$string.str_repeat($filler, $cdiff);
            break;

            // Not padded; returned as is (provided not longer than max, as tested above)
            case 'n':
                return $string;
            break;

            // Uhh not sure?
            default:
                return '';
            break;
        }
    }