/*******************************************************************************
 * Copyright 2019 2Fi Business Solutions Ltd.
 *
 * This code is part of the Core project.
 *
 * This code is copyrighted. Under no circumstances should any party, people,
 * or organization should redistribute any portions of this code in any form,
 * either verbatim or through electronic media, to any third parties, unless
 * under explicit written permission by 2Fi Business Solutions Ltd.
 ******************************************************************************/
package com.ffii.core.utils;

/**
 * String Utils based on Apache Commons StringUtils.
 *
 * @author Patrick
 */
public abstract class StringUtils extends org.apache.commons.lang3.StringUtils {

	/**
	 * The String {@code "0"}.
	 */
	public static final String ZERO = "0";

	/**
	 * The String {@code "1"}.
	 */
	public static final String ONE = "1";

	/**
	 * The String {@code "%"}.
	 */
	public static final String PERCENT = "%";

	/**
	 * The String {@code ","}.
	 */
	public static final String COMMA = ",";

	/**
	 * The String {@code "\r\n"} for line break on Windows
	 */
	public static final String LINE_BREAK_WINDOWS = "\r\n";

	/**
	 * The String {@code "\n"} for line break on Unix/Linux
	 */
	public static final String LINE_BREAK_LINUX = "\n";

	public static final String[] A2Z_LOWWER = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v",
			"w", "x", "y", "z" };
	public static final String[] A2Z_UPPER = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V",
			"W", "X", "Y", "Z" };

	public static final String concat(String segregator, final String... chars) {
		if (segregator == null) segregator = "";
		String rs = "";
		for (String c : chars) {
			if (c == null)
				continue;
			else {
				if (StringUtils.isBlank(rs)) {
					rs = c;
				} else {
					rs += segregator + c;
				}
			}
		}
		return rs;
	}
}
