This method will pad a String with a character or string
@param repeat how many times the string should be repeated
@param str character or string to be repeated
@return padded {@code String}
437057
public static String pad(int repeat, String str) {
        StringBuilder sb = new StringBuilder();
        for(int i=0; i < repeat; i++) {
            sb.append(str);
        }
        return sb.toString();
    }
241964
function stringRepeat (str, count) {
  var rest = '' + str
  if (str.repeat) {
    return str.repeat(count)
  }
  var list = isNaN(count) ? [] : new Array(parseInt(count))
  return list.join(rest) + (list.length > 0 ? rest : '')
}
532807
public static String[] splitString(final String str, final char splitChar) {
    final int length = str.length();
    final StringBuilder bulder = new StringBuilder(Math.max(8, length));

    int counter = 1;
    for (int i = 0; i < length; i++) {
      if (str.charAt(i) == splitChar) {
        counter++;
      }
    }

    final String[] result = new String[counter];

    int position = 0;
    for (int i = 0; i < length; i++) {
      final char chr = str.charAt(i);
      if (chr == splitChar) {
        result[position++] = bulder.toString();
        bulder.setLength(0);
      } else {
        bulder.append(chr);
      }
    }
    if (position < result.length) {
      result[position] = bulder.toString();
    }

    return result;
  }
1049468
public static void keyPressString(String str) {
		ClipboardUtil.setStr(str);
		keyPressWithCtrl(KeyEvent.VK_V);// 粘贴
		delay();
	}
634388
protected function pad($str, $final_length, $padding_side = 'right')
    {
        $padding = $final_length - $this->lengthWithoutTags($str);

        if ($padding_side == 'left') {
            return str_repeat(' ', $padding) . $str;
        }

        return $str . str_repeat(' ', $padding);
    }
1129777
public function stringPad($input, $pad_length, $pad_string = ' ')
    {
        $count = strlen($input);

        // Fix μ issues
        if(strpos($input, 'μ'))
            $count--;

        $space = $pad_length - $count;

        return str_repeat($pad_string, $space) . $input;
    }
1285733
function pad( str, chr, n ) {
  return (chr.repeat( Math.max( n - str.length, 0 ) ) + str).substr(-n)
}
570687
public static String padOrTrim(String str, int num) {
    if (str == null) {
      str = "null";
    }
    int leng = str.length();
    if (leng < num) {
      StringBuilder sb = new StringBuilder(str);
      for (int i = 0; i < num - leng; i++) {
        sb.append(' ');
      }
      return sb.toString();
    } else if (leng > num) {
      return str.substring(0, num);
    } else {
      return str;
    }
  }
470704
function repeat(str, n) {
    var result = '';

    for (var i = 0; i < n; i++) {
        result += str;
    }

    return result;
}
1172740
public static String repeat(char c, int count) {
      StringBuilder builder = new StringBuilder();
      for (int i = 0; i < count; i++) {
         builder.append(c);
      }
      return builder.toString();
   }
254176
public static String repeatChars(final char ch, final int count) {
        return CharBuffer.allocate(count).toString().replace('\0', ch);
    }
869645
function(str, len, padChar) {
    str = stringIt(str);
    if (str.length >= len) {
      return str;
    }
    var padStr = getPadding(padChar, len);
    return str + padStr.substr(str.length - len);
  }
304125
public static String pad(final StringBuffer buff, final String string,
            final int count)
   {
      for (int i = 0; i < count; i++)
      {
         buff.append(string);
      }

      return buff.toString();
   }
993780
protected void add(final String str) {
        if (str == null) {
            return;
        }

        final int len = str.length();
        int pos = 0;
        while (pos < len) {
            final int remainder = len - pos;
            if (remainder >= 4 && str.charAt(pos) == '^' && str.charAt(pos + 2) == '-') {
                // negated range
                set.add(CharRange.isNotIn(str.charAt(pos + 1), str.charAt(pos + 3)));
                pos += 4;
            } else if (remainder >= 3 && str.charAt(pos + 1) == '-') {
                // range
                set.add(CharRange.isIn(str.charAt(pos), str.charAt(pos + 2)));
                pos += 3;
            } else if (remainder >= 2 && str.charAt(pos) == '^') {
                // negated char
                set.add(CharRange.isNot(str.charAt(pos + 1)));
                pos += 2;
            } else {
                // char
                set.add(CharRange.is(str.charAt(pos)));
                pos += 1;
            }
        }
    }
593134
public static RegExpr createKeyword(String str) {
        int i;
        RegExpr[] chars;

        if (str.length() == 1) {
            return new Range(str.charAt(0));
        } else {
            chars = new RegExpr[str.length()];
            for (i = 0; i < chars.length; i++) {
                chars[i] = new Range(str.charAt(i));
            }
            return new Sequence(chars);
        }
    }
697417
public StringGrabber insertRepeat(String str, int repeatCount) {
		for (int i = 0; i < repeatCount; i++) {
			insertIntoHead(str);
		}
		return StringGrabber.this;
	}
926088
public static String repeatString( String pattern, int repeats )
    {
        StringBuilder buffer = new StringBuilder( pattern.length() * repeats );
        for( int i = 0; i < repeats; i++ )
        {
            buffer.append( pattern );
        }

        return new String( buffer );
    }