All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.tukeof.common.util.StringUtil Maven / Gradle / Ivy

The newest version!
package com.tukeof.common.util;

/**
 * Create by tuke on 2019-02-16
 */
public class StringUtil {

    public static String repeat(char c, int length) {
        if (length <= 0) return "";

        StringBuilder sb = new StringBuilder(length);
        for (int i = 0; i < length; i++) {
            sb.append(c);
        }
        return sb.toString();
    }

    public static String repeat(CharSequence s, int length) {
        if (length <= 0) return "";

        StringBuilder sb = new StringBuilder(length);
        for (int i = 0; i < length; i++) {
            sb.append(s);
        }
        return sb.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy