top.doudou.core.builder.StrBuilder Maven / Gradle / Ivy
package com.zhcf.carloan.process;
import java.util.StringJoiner;
/**
* @Description
* @Author 傻男人 <[email protected]>
* @Date 2021-02-24 13:56
* @Version V1.0
*/
public class StrBuilder {
/**
* 创建StringBuilder对象
*
* @return StringBuilder对象
*/
public static StringBuilder builder() {
return new StringBuilder();
}
/**
* 创建StringBuilder对象
*
* @return StringBuilder对象
*/
public static StringBuilder builder(int capacity) {
return new StringBuilder(capacity);
}
/**
* 创建StringBuilder对象
*
* @return StringBuilder对象
*/
public static StringBuilder builder(String... strs) {
final StringBuilder sb = new StringBuilder();
for (String str : strs) {
sb.append(str);
}
return sb;
}
/**
* 创建StringJoiner对象
*
* @return StringJoiner对象
*/
public static StringJoiner joiner() {
return new StringJoiner(",","","");
}
/**
* 创建StringBuilder对象
* @param delimiter 分隔符
* @return StringJoiner对象
*/
public static StringJoiner joiner(CharSequence delimiter) {
return new StringJoiner(delimiter,"","");
}
/**
* 创建StringBuilder对象
* @param delimiter 分隔符
* @param prefix 前缀
* @param suffix 后缀
* @return StringJoiner对象
*/
public static StringJoiner joiner(CharSequence delimiter,
CharSequence prefix,
CharSequence suffix) {
return new StringJoiner(delimiter,prefix,suffix);
}
/**
* 创建StringBuffer对象
*
* @return StringBuffer对象
*/
public static StringBuffer buffer() {
return new StringBuffer();
}
/**
* 创建StringBuffer对象
*
* @return StringBuffer对象
*/
public static StringBuffer buffer(int capacity) {
return new StringBuffer(capacity);
}
/**
* 创建StringBuffer对象
*
* @return StringBuffer对象
*/
public static StringBuffer buffer(String... strs) {
final StringBuffer sb = new StringBuffer();
for (String str : strs) {
sb.append(str);
}
return sb;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy