/*
 * Copyright (C), 2014-2015, 杭州小卡科技有限公司
 * FileName: MyStringUtils.java
 * Author:   奕超
 * Date:    2017/3/30 下午3:01
 * Description:
 */
package io.github.randyjin.util.string;

import org.apache.commons.lang.StringUtils;

/**
 * MyStringUtils
 *
 * @author 奕超
 * @date 2017/3/30
 */
public class MyStringUtils {

    public static String repeat(String source, int count) {
        if(source == null) {
            return null;
        }
        return StringUtils.repeat(source, count);
    }

    public static String replaceMiddle(String source, int startCount, int endCount, String replaceStr) {
        if(StringUtils.isEmpty(source)) {
            return source;
        }
        int sourceLength = source.length();
        if(sourceLength <= startCount + endCount) {
            return source;
        }
        int needReplaceCount = sourceLength - startCount - endCount;
        String prefix = source.substring(0, startCount);
        String suffix = source.substring(sourceLength - endCount,sourceLength);
        return prefix + repeat(replaceStr, needReplaceCount) + suffix;
    }
}

@@ -1,144 +1,4 @@
-/*%0A * Copyright (C), 2014-2015, %E6%9D%AD%E5%B7%9E%E5%B0%8F%E5%8D%A1%E7%A7%91%E6%8A%80%E6%9C%89%E9%99%90%E5%85%AC%E5%8F%B8%0A * FileName: MyStringUtils.java%0A * Author:   %E5%A5%95%E8%B6%85%0A * Date:    2017/3/30 %E4%B8%8B%E5%8D%883:01%0A * Description:%0A */%0A
 pack

Update MyStringUtils.java