// PadRight returns a new string of a specified length in which the end of the current string is padded with spaces or with a specified Unicode character.
161469
func PadRight(str string, length int, pad byte) string {
	slen := runewidth.StringWidth(str)
	if slen >= length {
		return str
	}
	buf := bytes.NewBufferString(str)
	for i := 0; i < length-slen; i++ {
		buf.WriteByte(pad)
	}
	return buf.String()
}
61878
func unpad(paddedtext []byte) ([]byte, error) {
	length := len(paddedtext)
	paddedtext, lbyte := paddedtext[:length-1], paddedtext[length-1]
	pad := int(lbyte)
	if pad >= 256 || pad > length {
		return nil, errors.New("padding malformed")
	}
	return paddedtext[:length-(pad)], nil
}
1126284
func padStringArray(arr []string, l int) []string {
	if l <= len(arr) {
		return arr
	}
	return append(arr, make([]string, l-len(arr))...)
}
133521
func canonicalPadding(b []byte) error {
	switch {
	case b[0]&0x80 == 0x80:
		return errNegativeValue
	case len(b) > 1 && b[0] == 0x00 && b[1]&0x80 != 0x80:
		return errExcessivelyPaddedValue
	default:
		return nil
	}
}
1300170
func base64EncWithoutPadding(b []byte) string {
	s := base64.StdEncoding.EncodeToString(b)
	return strings.TrimRight(s, "=")
}
825592
func (a *Writer) Right(n int) (int, error) {
	return a.WriteString(Right(n))
}
12791
func padUnits(width int, value float64, precision int, units string) string {
	format1 := fmt.Sprintf("%%-%ds", width)
	format2 := fmt.Sprintf("%%.%df%%s", precision)
	return fmt.Sprintf(format1, fmt.Sprintf(format2, value, units))
}
173064
function padRight(val, len, offset, char) {
    /* istanbul ignore if */
    if (!is_1.isValue(val) || !is_1.isString(val))
        return null;
    // If offset is a string
    // count its length.
    if (is_1.isString(offset))
        offset = offset.length;
    char = char || ' ';
    while (len--) {
        val += char;
    }
    if (offset)
        val += padRight('', offset, null, char);
    return val;
}
1016874
func padID(id string) string {
	expectedLen := 0
	if len(id) < 16 {
		expectedLen = 16
	} else if len(id) > 16 && len(id) < 32 {
		expectedLen = 32
	} else {
		return id
	}

	return pads[expectedLen-len(id)] + id
}
1182382
func skipPadding(r io.ReadSeeker, pad int64) error {
	pos, err := r.Seek(0, os.SEEK_CUR)
	if err != nil {
		return err
	}
	if pos%pad == 0 {
		return nil
	}
	if _, err := r.Seek(pad-(pos%pad), os.SEEK_CUR); err != nil {
		return err
	}
	return nil
}
267263
func (e *Encoding) pad(s string, minlen int) string {
	if len(s) >= minlen {
		return s
	}

	format := fmt.Sprint(`%0`, strconv.Itoa(minlen), "s")
	return fmt.Sprintf(format, s)
}
1251380
func Column(w int, s string) string {
	pad := w - len(s)
	padding := make([]byte, pad)
	for i := 0; i < pad; i++ {
		padding[i] = 0x20
	}
	return fmt.Sprintf("%s%s", string(padding), s)
}
393046
func (m *Millipede) getPadding(i uint64) string {
	if len(m.paddingOffsets) == 0 {
		m.paddingOffsets = append(m.paddingOffsets, "")
		//m.paddingOffsets = make([]string)
		if m.Curve > 0 {
			for n := uint64(1); n < m.Curve*2; n++ {
				size := int(math.Min(float64(n%(m.Curve*2)), float64(m.Curve*2-n%(m.Curve*2))))
				m.paddingOffsets = append(m.paddingOffsets, strings.Repeat(" ", size))
			}

			// --opposite support
			if m.Opposite {
				m.paddingOffsets = append(m.paddingOffsets[m.Curve:], m.paddingOffsets[:m.Curve]...)
			}
		}
	}
	if len(m.paddingOffsets) > 0 && m.Curve > 0 {
		return m.paddingOffsets[(m.Steps+i)%(m.Curve*2)]
	}
	return ""
}
592754
func (t *Tabulate) padRow(arr []string, padding int) []string {
	if len(arr) < 1 {
		return arr
	}
	padded := make([]string, len(arr))
	for index, el := range arr {
		b := createBuffer()
		b.Write(" ", padding)
		b.Write(el, 1)
		b.Write(" ", padding)
		padded[index] = b.String()
	}
	return padded
}
1138310
func unpad(data []byte, terminator byte) ([]byte, error) {
	for i := 1; i <= 16; i++ {
		switch data[len(data)-i] {
		case 0:
			continue
		case terminator:
			return data[:len(data)-i], nil
		default:
			return nil, fmt.Errorf("Expected end of padding, got %d", data[len(data)-i])
		}
	}
	return nil, fmt.Errorf("Expected end of padding, got 0")
}
389871
func LeftPadZero(input string, padLength int) string {
	return fmt.Sprintf(`%0*s`, padLength, input)
}
163335
func Pad(s string) string {
	if !strings.HasSuffix(s, "=") && len(s)%8 != 0 {
		for len(s)%8 != 0 {
			s += "="
		}
	}
	return s
}