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

cn.binarywang.wx.miniapp.util.JoinerUtils Maven / Gradle / Ivy

There is a newer version: 4.6.7.B
Show newest version
/**
 * Copyright (c) 2019,sunnybs.
 * All Rights Reserved.
 * 

* Project Name:yigou */ package cn.binarywang.wx.miniapp.util; import com.google.common.base.Joiner; /** * ClassName: JoinerUtils
* Description: 字符串连接器
* Date: 2019年10月18日 下午1:42:59
* * @author wsp */ public class JoinerUtils { private static final String NULL = "null"; /** *

* 空白连接器,忽略null *

* *
     * JoinerUtils.blankJoiner.join("a", "b", "c");
     * result : abc
     * 
     * JoinerUtils.blankJoiner.join("a", null, "c");
     * result : ac
     * 
*/ public static final Joiner blankJoiner = Joiner.on("").skipNulls(); /** *

* 空白连接器 *

* *
     * JoinerUtils.blankJoinerWithNull.join("a", "b", "c");
     * result : abc
     * 
     * JoinerUtils.blankJoinerWithNull.join("a", null, "c");
     * result : anullc
     * 
*/ public static final Joiner blankJoinerWithNull = Joiner.on("").useForNull(NULL); /** *

* 空格连接器,忽略null *

* *
     * JoinerUtils.spaceJoiner.join("a", "b", "c");
     * result : a b c
     * 
     * JoinerUtils.spaceJoiner.join("a", null, "c");
     * result : a c
     * 
*/ public static final Joiner spaceJoiner = Joiner.on(" ").skipNulls(); /** *

* 空格连接器 *

* *
     * JoinerUtils.spaceJoinerWithNull.join("a", "b", "c");
     * result : a b c
     * 
     * JoinerUtils.spaceJoinerWithNull.join("a", null, "c");
     * result : a null c
     * 
*/ public static final Joiner spaceJoinerWithNull = Joiner.on(" ").useForNull(NULL); /** *

* 逗号分隔符连接器,忽略null *

* *
   * JoinerUtils.commaJoiner.join("a", "b", "c");
   * result : a,b,c
   *
   * JoinerUtils.commaJoiner.join("a", null, "c");
   * result : a,c
   * 
*/ public static final Joiner commaJoiner = Joiner.on(",").skipNulls(); /** *

* 逗号分隔符连接器 *

* *
   * JoinerUtils.commaJoinerWithNull.join("a", "b", "c");
   * result : a,b,c
   *
   * JoinerUtils.commaJoinerWithNull.join("a", null, "c");
   * result : a,null,c
   * 
*/ public static final Joiner commaJoinerWithNull = Joiner.on(",").useForNull(NULL); /** *

* 等号分隔符连接器,忽略null *

* *
   * JoinerUtils.equalJoiner.join("a", "b", "c");
   * result : a=b=c
   *
   * JoinerUtils.equalJoiner.join("a", null, "c");
   * result : a=c
   * 
*/ public static final Joiner equalJoiner = Joiner.on("=").skipNulls(); /** *

* 等号分隔符连接器 *

* *
   * JoinerUtils.equalJoinerWithNull.join("a", "b", "c");
   * result : a=b=c
   *
   * JoinerUtils.equalJoinerWithNull.join("a", null, "c");
   * result : a=null=c
   * 
*/ public static final Joiner equalJoinerWithNull = Joiner.on("=").useForNull(NULL); /** *

* 竖线分隔符连接器,忽略null *

* *
     * JoinerUtils.vLineJoiner.join("a", "b", "c");
     * result : a|b|c
     * 
     * JoinerUtils.vLineJoiner.join("a", null, "c");
     * result : a|c
     * 
*/ public static final Joiner vLineJoiner = Joiner.on("|").skipNulls(); /** *

* 竖线分隔符连接器 *

* *
     * JoinerUtils.vLineJoinerWithNull.join("a", "b", "c");
     * result : a|b|c
     * 
     * JoinerUtils.vLineJoinerWithNull.join("a", null, "c");
     * result : a|null|c
     * 
*/ public static final Joiner vLineJoinerWithNull = Joiner.on("|").useForNull(NULL); /** *

* 中横线分隔符连接器,忽略null *

* *
     * JoinerUtils.hLineJoiner.join("a", "b", "c");
     * result : a-b-c
     * 
     * JoinerUtils.hLineJoiner.join("a", null, "c");
     * result : a-c
     * 
*/ public static final Joiner hLineJoiner = Joiner.on("-").skipNulls(); /** *

* 中横线分隔符连接器 *

* *
     * JoinerUtils.hLineJoinerWithNull.join("a", "b", "c");
     * result : a-b-c
     * 
     * JoinerUtils.hLineJoinerWithNull.join("a", null, "c");
     * result : a-null-c
     * 
*/ public static final Joiner hLineJoinerWithNull = Joiner.on("-").useForNull(NULL); /** *

* 下划线分隔符连接器,忽略null *

* *
     * JoinerUtils.underlineJoiner.join("a", "b", "c");
     * result : a_b_c
     * 
     * JoinerUtils.underlineJoiner.join("a", null, "c");
     * result : a_c
     * 
*/ public static final Joiner underlineJoiner = Joiner.on("_").skipNulls(); /** *

* 下划线分隔符连接器 *

* *
     * JoinerUtils.underlineJoinerWithNull.join("a", "b", "c");
     * result : a_b_c
     * 
     * JoinerUtils.underlineJoinerWithNull.join("a", null, "c");
     * result : a_null_c
     * 
*/ public static final Joiner underlineJoinerWithNull = Joiner.on("_").useForNull(NULL); /** *

* 斜线分隔符连接器,忽略null *

* *
     * JoinerUtils.pathJoiner.join("a", "b", "c");
     * result : a/b/c
     * 
     * JoinerUtils.pathJoiner.join("a", null, "c");
     * result : a/c
     * 
*/ public static final Joiner pathJoiner = Joiner.on("/").skipNulls(); /** *

* 斜线分隔符连接器 *

* *
     * JoinerUtils.pathJoinerWithNull.join("a", "b", "c");
     * result : a/b/c
     * 
     * JoinerUtils.pathJoinerWithNull.join("a", null, "c");
     * result : a/null/c
     * 
*/ public static final Joiner pathJoinerWithNull = Joiner.on("/").useForNull(NULL); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy