Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
org.op4j.functions.FnString Maven / Gradle / Ivy
/*
* =============================================================================
*
* Copyright (c) 2010, The OP4J team (http://www.op4j.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* =============================================================================
*/
package org.op4j.functions;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.nio.charset.Charset;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.text.ParseException;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.LocaleUtils;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.Validate;
import org.apache.commons.lang.time.DateUtils;
import org.op4j.Op;
import org.op4j.exceptions.ExecutionException;
import org.op4j.functions.FnString.Replace.ReplaceType;
import org.op4j.functions.FnStringAuxNumberConverters.ToBigDecimal;
import org.op4j.functions.FnStringAuxNumberConverters.ToBigInteger;
import org.op4j.functions.FnStringAuxNumberConverters.ToByte;
import org.op4j.functions.FnStringAuxNumberConverters.ToDouble;
import org.op4j.functions.FnStringAuxNumberConverters.ToFloat;
import org.op4j.functions.FnStringAuxNumberConverters.ToInteger;
import org.op4j.functions.FnStringAuxNumberConverters.ToLong;
import org.op4j.functions.FnStringAuxNumberConverters.ToShort;
import org.op4j.util.VarArgsUtil;
/**
*
* @since 1.0
*
* @author Soraya Sánchez
* @author Daniel Fernández
*
*/
public final class FnString {
private static final Function ESCAPE_CSV_STRING_FUNC = new EscapeCSV();
private static final Function UNESCAPE_CSV_STRING_FUNC = new UnescapeCSV();
private static final Function ESCAPE_XML_STRING_FUNC = new EscapeXML();
private static final Function UNESCAPE_XML_STRING_FUNC = new UnescapeXML();
private static final Function ESCAPE_HTML_STRING_FUNC = new EscapeHTML();
private static final Function UNESCAPE_HTML_STRING_FUNC = new UnescapeHTML();
private static final Function ESCAPE_JAVASCRIPT_STRING_FUNC = new EscapeJavaScript();
private static final Function UNESCAPE_JAVASCRIPT_STRING_FUNC = new UnescapeJavaScript();
private static final Function TO_UPPER_CASE_STRING_FUNC = new ToUpperCase();
private static final Function TO_LOWER_CASE_STRING_FUNC = new ToLowerCase();
private static final Function UN_CAPITALIZE_STRING_FUNC = new UnCapitalize();
private static final Function CAPITALIZE_STRING_FUNC = new Capitalize();
private static final Function TRIM_STRING_FUNC = new Trim();
private static final Function STRIP_STRING_FUNC = new Strip();
private static final Function TO_BIG_DECIMAL = new ToBigDecimal();
private static final Function TO_BIG_INTEGER = new ToBigInteger();
private static final Function TO_DOUBLE = new ToDouble();
private static final Function TO_FLOAT = new ToFloat();
private static final Function TO_LONG = new ToLong();
private static final Function TO_INTEGER = new ToInteger();
private static final Function TO_SHORT = new ToShort();
private static final Function TO_BYTE = new ToByte();
private static final Function TO_BOOLEAN = new ToBoolean();
private static final Function> SPLIT = new Split();
private static final Function SPLIT_AS_ARRAY = new SplitAsArray();
private static final Function,String> JOIN = new Join();
private static final Function JOIN_ARRAY = new JoinArray();
private static final Function ASCIIFY = new Asciify();
private static final Function IS_ALPHA = new IsAlpha();
private static final Function IS_ALPHA_SPACE = new IsAlpha(true);
private static final Function IS_NUMERIC = new IsNumeric();
private static final Function IS_NUMERIC_SPACE = new IsNumeric(true);
private static final Function CAN_BE_BIG_DECIMAL = new CanBeBigDecimal();
private static final Function CAN_BE_BIG_INTEGER = new CanBeBigInteger();
private static final Function CAN_BE_DOUBLE = new CanBeDouble();
private static final Function CAN_BE_FLOAT = new CanBeFloat();
private static final Function CAN_BE_LONG = new CanBeLong();
private static final Function CAN_BE_INTEGER = new CanBeInteger();
private static final Function CAN_BE_SHORT = new CanBeShort();
private static final Function CAN_BE_BYTE = new CanBeByte();
private static final Function IS_VALID_BIG_INTEGER = new IsValidBigInteger();
private static final Function IS_VALID_LONG = new IsValidLong();
private static final Function IS_VALID_INTEGER = new IsValidInteger();
private static final Function IS_VALID_SHORT = new IsValidShort();
private static final Function IS_VALID_BYTE = new IsValidByte();
private static final Function IS_EMPTY = new IsEmpty();
private static final Function IS_BLANK = new IsBlank();
private static final Function REVERSE = new Reverse();
private FnString() {
super();
}
/**
*
* Converts a String into a BigDecimal, using the default configuration
* for for decimal point and precision.
*
*
* @return the resulting BigDecimal object
*/
public static final Function toBigDecimal() {
return TO_BIG_DECIMAL;
}
/**
*
* Converts a String into a BigDecimal, using the specified locale for decimal
* point and thousands separator configuration.
*
*
* @param locale the locale defining the way in which the number was written
* @return the resulting BigDecimal object
*/
public static final Function toBigDecimal(final Locale locale) {
return new ToBigDecimal(locale);
}
/**
*
* Converts a String into a BigDecimal, using the specified locale for decimal
* point and thousands separator configuration. Locale is specified as a String
* (for example: "en_US", "es_ES", etc.)
*
*
* @param locale the locale defining the way in which the number was written
* @return the resulting BigDecimal object
*/
public static final Function toBigDecimal(final String locale) {
return new ToBigDecimal(locale);
}
/**
*
* Converts a String into a BigDecimal, using the specified decimal point
* configuration ({@link DecimalPoint}). The target String should contain no
* thousand separators.
*
*
* @param decimalPoint the decimal point being used by the String
* @return the resulting BigDecimal object
*/
public static final Function toBigDecimal(final DecimalPoint decimalPoint) {
return new ToBigDecimal(decimalPoint);
}
/**
*
* Converts a String into a BigDecimal, using the default configuration
* for for decimal point and thousands separator and establishing the specified scale. Rounding
* mode is used for setting the scale to the specified value.
*
*
* @param scale the desired scale for the resulting BigDecimal object
* @param roundingMode the rounding mode to be used when setting the scale
* @return the resulting BigDecimal object
*/
public static final Function toBigDecimal(final int scale, final RoundingMode roundingMode) {
return new ToBigDecimal(scale, roundingMode);
}
/**
*
* Converts a String into a BigDecimal, using the specified locale for decimal
* point and thousands separator configuration and establishing the specified scale. Rounding
* mode is used for setting the scale to the specified value.
*
*
* @param scale the desired scale for the resulting BigDecimal object
* @param roundingMode the rounding mode to be used when setting the scale
* @param locale the locale defining the way in which the number was written
* @return the resulting BigDecimal object
*/
public static final Function toBigDecimal(final int scale, final RoundingMode roundingMode, final Locale locale) {
return new ToBigDecimal(scale, roundingMode, locale);
}
/**
*
* Converts a String into a BigDecimal, using the specified locale for decimal
* point and thousands separator configuration and establishing the specified scale. Rounding
* mode is used for setting the scale to the specified value. Locale is specified as a String
* (for example: "en_US", "es_ES", etc.)
*
*
* @param scale the desired scale for the resulting BigDecimal object
* @param roundingMode the rounding mode to be used when setting the scale
* @param locale the locale defining the way in which the number was written
* @return the resulting BigDecimal object
*/
public static final Function toBigDecimal(final int scale, final RoundingMode roundingMode, final String locale) {
return new ToBigDecimal(scale, roundingMode, locale);
}
/**
*
* Converts a String into a BigDecimal, using the specified decimal point
* configuration ({@link DecimalPoint}) and establishing the specified scale. Rounding
* mode is used for setting the scale to the specified value.. The target String should contain no
* thousand separators.
*
*
* @param scale the desired scale for the resulting BigDecimal object
* @param roundingMode the rounding mode to be used when setting the scale
* @param decimalPoint the decimal point being used by the String
* @return the resulting BigDecimal object
*/
public static final Function toBigDecimal(final int scale, final RoundingMode roundingMode, final DecimalPoint decimalPoint) {
return new ToBigDecimal(scale, roundingMode, decimalPoint);
}
/**
*
* Converts a String into a BigInteger, using the default configuration.
* Any fractional part of the input String will be removed.
*
*
* @return the resulting BigInteger object
*/
public static final Function toBigInteger() {
return TO_BIG_INTEGER;
}
/**
*
* Converts a String into a BigInteger, using the specified locale for decimal
* point and thousands separator configuration.
* Any fractional part of the input String will be removed.
*
*
* @param locale the locale defining the way in which the number was written
* @return the resulting BigInteger object
*/
public static final Function toBigInteger(final Locale locale) {
return new ToBigInteger(locale);
}
/**
*
* Converts a String into a BigInteger, using the specified locale for decimal
* point and thousands separator configuration. Locale is specified as a String
* (for example: "en_US", "es_ES", etc.).
* Any fractional part of the input String will be removed.
*
*
* @param locale the locale defining the way in which the number was written
* @return the resulting BigInteger object
*/
public static final Function toBigInteger(final String locale) {
return new ToBigInteger(locale);
}
/**
*
* Converts a String into a BigInteger, using the specified decimal point
* configuration ({@link DecimalPoint}). The target String should contain no
* thousand separators.
* Any fractional part of the input String will be removed.
*
*
* @param decimalPoint the decimal point being used by the String
* @return the resulting BigInteger object
*/
public static final Function toBigInteger(final DecimalPoint decimalPoint) {
return new ToBigInteger(decimalPoint);
}
/**
*
* Converts a String into a BigInteger, using the specified radix for computing the
* equivalent number. The input String must be a valid BigInteger in the given radix
* (i.e. if radix is 5, 34 would be a valid input whereas 34.3 wouldn't as '.' is not allowed).
*
*
* @param radix the radix in which the number is supposedly represented in the String
* @return the resulting BigInteger object
*/
public static final Function toBigInteger(final int radix) {
return new ToBigInteger(Integer.valueOf(radix));
}
/**
*
* Converts a String into a BigInteger, using the default configuration
* for for decimal point and thousands separator. Rounding
* mode is used for removing the decimal part of the number.
* Any fractional part of the input String will be removed.
*
*
* @param roundingMode the rounding mode to be used when setting the scale
* @return the resulting BigInteger object
*/
public static final Function toBigInteger(final RoundingMode roundingMode) {
return new ToBigInteger(roundingMode);
}
/**
*
* Converts a String into a BigInteger, using the specified decimal point
* configuration ({@link DecimalPoint}). Rounding mode is used for removing the
* decimal part of the number. The target String should contain no
* thousand separators.
* Any fractional part of the input String will be removed.
*
*
* @param roundingMode the rounding mode to be used when setting the scale
* @param decimalPoint the decimal point being used by the String
* @return the resulting BigInteger object
*/
public static final Function toBigInteger(final RoundingMode roundingMode, final DecimalPoint decimalPoint) {
return new ToBigInteger(roundingMode, decimalPoint);
}
/**
*
* Converts a String into a BigInteger, using the specified locale for determining
* decimal point. Rounding mode is used for removing the
* decimal part of the number.
* Any fractional part of the input String will be removed.
*
*
* @param roundingMode the rounding mode to be used when setting the scale
* @param locale the locale defining the way in which the number was written
* @return the resulting BigInteger object
*/
public static final Function toBigInteger(final RoundingMode roundingMode, final Locale locale) {
return new ToBigInteger(roundingMode, locale);
}
/**
*
* Converts a String into a BigInteger, using the specified locale for determining
* decimal point. Rounding mode is used for removing the
* decimal part of the number. Locale is specified as a String
* (for example: "en_US", "es_ES", etc.).
* Any fractional part of the input String will be removed.
*
*
* @param roundingMode the rounding mode to be used when setting the scale
* @param locale the locale defining the way in which the number was written
* @return the resulting BigInteger object
*/
public static final Function toBigInteger(final RoundingMode roundingMode, final String locale) {
return new ToBigInteger(roundingMode, locale);
}
/**
*
* Converts a String into a Double, using the default configuration
* for for decimal point and precision.
* The input string must be between
* {@link Double#MIN_VALUE} and {@link Double#MAX_VALUE}
*
*
* @return the resulting Double object
*/
public static final Function toDouble() {
return TO_DOUBLE;
}
/**
*
* Converts a String into a Double, using the specified locale for decimal
* point and thousands separator configuration.
* The input string must be between
* {@link Double#MIN_VALUE} and {@link Double#MAX_VALUE}
*
*
* @param locale the locale defining the way in which the number was written
* @return the resulting Double object
*/
public static final Function toDouble(final Locale locale) {
return new ToDouble(locale);
}
/**
*
* Converts a String into a Double, using the specified locale for decimal
* point and thousands separator configuration. Locale is specified as a String
* (for example: "en_US", "es_ES", etc.). The input string must be between
* {@link Double#MIN_VALUE} and {@link Double#MAX_VALUE}
*
*
* @param locale the locale defining the way in which the number was written
* @return the resulting Double object
*/
public static final Function toDouble(final String locale) {
return new ToDouble(locale);
}
/**
*
* Converts a String into a Double, using the specified decimal point
* configuration ({@link DecimalPoint}). The target String should contain no
* thousand separators. The input string must be between
* {@link Double#MIN_VALUE} and {@link Double#MAX_VALUE}
*
*
* @param decimalPoint the decimal point being used by the String
* @return the resulting Double object
*/
public static final Function toDouble(final DecimalPoint decimalPoint) {
return new ToDouble(decimalPoint);
}
/**
*
* Converts a String into a Double, using the default configuration
* for for decimal point and thousands separator and establishing the specified scale. Rounding
* mode is used for setting the scale to the specified value.
* The input string must be between
* {@link Double#MIN_VALUE} and {@link Double#MAX_VALUE}
*
*
* @param scale the desired scale for the resulting Double object
* @param roundingMode the rounding mode to be used when setting the scale
* @return the resulting Double object
*/
public static final Function toDouble(final int scale, final RoundingMode roundingMode) {
return new ToDouble(scale, roundingMode);
}
/**
*
* Converts a String into a Double, using the specified locale for decimal
* point and thousands separator configuration and establishing the specified scale. Rounding
* mode is used for setting the scale to the specified value.
* The input string must be between
* {@link Double#MIN_VALUE} and {@link Double#MAX_VALUE}
*
*
* @param scale the desired scale for the resulting Double object
* @param roundingMode the rounding mode to be used when setting the scale
* @param locale the locale defining the way in which the number was written
* @return the resulting Double object
*/
public static final Function toDouble(final int scale, final RoundingMode roundingMode, final Locale locale) {
return new ToDouble(scale, roundingMode, locale);
}
/**
*
* Converts a String into a Double, using the specified locale for decimal
* point and thousands separator configuration and establishing the specified scale. Rounding
* mode is used for setting the scale to the specified value. Locale is specified as a String
* (for example: "en_US", "es_ES", etc.).
* The input string must be between
* {@link Double#MIN_VALUE} and {@link Double#MAX_VALUE}
*
*
* @param scale the desired scale for the resulting Double object
* @param roundingMode the rounding mode to be used when setting the scale
* @param locale the locale defining the way in which the number was written
* @return the resulting Double object
*/
public static final Function toDouble(final int scale, final RoundingMode roundingMode, final String locale) {
return new ToDouble(scale, roundingMode, locale);
}
/**
*
* Converts a String into a Double, using the specified decimal point
* configuration ({@link DecimalPoint}) and establishing the specified scale. Rounding
* mode is used for setting the scale to the specified value.
* The input string must be between
* {@link Double#MIN_VALUE} and {@link Double#MAX_VALUE}
*
*
* @param scale the desired scale for the resulting Double object
* @param roundingMode the rounding mode to be used when setting the scale
* @param decimalPoint the decimal point being used by the String
* @return the resulting Double object
*/
public static final Function toDouble(final int scale, final RoundingMode roundingMode, final DecimalPoint decimalPoint) {
return new ToDouble(scale, roundingMode, decimalPoint);
}
/**
*
* Converts a String into a Float, using the default configuration
* for for decimal point and precision.
* The input string must be between
* {@link Float#MIN_VALUE} and {@link Float#MAX_VALUE}
*
*
* @return the resulting Float object
*/
public static final Function toFloat() {
return TO_FLOAT;
}
/**
*
* Converts a String into a Float, using the specified locale for decimal
* point and thousands separator configuration. The input string must be between
* {@link Float#MIN_VALUE} and {@link Float#MAX_VALUE}
*
*
* @param locale the locale defining the way in which the number was written
* @return the resulting Float object
*/
public static final Function toFloat(final Locale locale) {
return new ToFloat(locale);
}
/**
*
* Converts a String into a Float, using the specified locale for decimal
* point and thousands separator configuration. Locale is specified as a String
* (for example: "en_US", "es_ES", etc.). The input string must be between
* {@link Float#MIN_VALUE} and {@link Float#MAX_VALUE}
*
*
* @param locale the locale defining the way in which the number was written
* @return the resulting Float object
*/
public static final Function toFloat(final String locale) {
return new ToFloat(locale);
}
/**
*
* Converts a String into a Float, using the specified decimal point
* configuration ({@link DecimalPoint}). The target String should contain no
* thousand separators. The input string must be between
* {@link Float#MIN_VALUE} and {@link Float#MAX_VALUE}
*
*
* @param decimalPoint the decimal point being used by the String
* @return the resulting Float object
*/
public static final Function toFloat(final DecimalPoint decimalPoint) {
return new ToFloat(decimalPoint);
}
/**
*
* Converts a String into a Float, using the default configuration
* for for decimal point and thousands separator and establishing the specified scale. Rounding
* mode is used for setting the scale to the specified value.
* The input string must be between
* {@link Float#MIN_VALUE} and {@link Float#MAX_VALUE}
*
*
* @param scale the desired scale for the resulting Float object
* @param roundingMode the rounding mode to be used when setting the scale
* @return the resulting Float object
*/
public static final Function toFloat(final int scale, final RoundingMode roundingMode) {
return new ToFloat(scale, roundingMode);
}
/**
*
* Converts a String into a Float, using the specified locale for decimal
* point and thousands separator configuration and establishing the specified scale. Rounding
* mode is used for setting the scale to the specified value.
* The input string must be between
* {@link Float#MIN_VALUE} and {@link Float#MAX_VALUE}
*
*
* @param scale the desired scale for the resulting Float object
* @param roundingMode the rounding mode to be used when setting the scale
* @param locale the locale defining the way in which the number was written
* @return the resulting Float object
*/
public static final Function toFloat(final int scale, final RoundingMode roundingMode, final Locale locale) {
return new ToFloat(scale, roundingMode, locale);
}
/**
*
* Converts a String into a Float, using the specified locale for decimal
* point and thousands separator configuration and establishing the specified scale. Rounding
* mode is used for setting the scale to the specified value. Locale is specified as a String
* (for example: "en_US", "es_ES", etc.). The input string must be between
* {@link Float#MIN_VALUE} and {@link Float#MAX_VALUE}
*
*
* @param scale the desired scale for the resulting Float object
* @param roundingMode the rounding mode to be used when setting the scale
* @param locale the locale defining the way in which the number was written
* @return the resulting Float object
*/
public static final Function toFloat(final int scale, final RoundingMode roundingMode, final String locale) {
return new ToFloat(scale, roundingMode, locale);
}
/**
*
* Converts a String into a Float, using the specified decimal point
* configuration ({@link DecimalPoint}) and establishing the specified scale. Rounding
* mode is used for setting the scale to the specified value.. The target String should contain no
* thousand separators. The input string must be between
* {@link Float#MIN_VALUE} and {@link Float#MAX_VALUE}
*
*
* @param scale the desired scale for the resulting Float object
* @param roundingMode the rounding mode to be used when setting the scale
* @param decimalPoint the decimal point being used by the String
* @return the resulting Float object
*/
public static final Function toFloat(final int scale, final RoundingMode roundingMode, final DecimalPoint decimalPoint) {
return new ToFloat(scale, roundingMode, decimalPoint);
}
/**
*
* Converts a String into a Long, using the default configuration.
* The integer part of the input string must be between
* {@link Long#MIN_VALUE} and {@link Long#MAX_VALUE}
*
*
* @return the resulting Long object
*/
public static final Function toLong() {
return TO_LONG;
}
/**
*
* Converts a String into a Long, using the specified locale for decimal
* point and thousands separator configuration. The
* integer part of the input string must be between
* {@link Long#MIN_VALUE} and {@link Long#MAX_VALUE}
*
*
* @param locale the locale defining the way in which the number was written
* @return the resulting Long object
*/
public static final Function toLong(final Locale locale) {
return new ToLong(locale);
}
/**
*
* Converts a String into a Long, using the specified locale for decimal
* point and thousands separator configuration. Locale is specified as a String
* (for example: "en_US", "es_ES", etc.). The
* integer part of the input string must be between
* {@link Long#MIN_VALUE} and {@link Long#MAX_VALUE}
*
*
* @param locale the locale defining the way in which the number was written
* @return the resulting Long object
*/
public static final Function toLong(final String locale) {
return new ToLong(locale);
}
/**
*
* Converts a String into a Long, using the specified decimal point
* configuration ({@link DecimalPoint}). The target String should contain no
* thousand separators. The integer part of the input string must be between
* {@link Long#MIN_VALUE} and {@link Long#MAX_VALUE}
*
*
* @param decimalPoint the decimal point being used by the String
* @return the resulting Long object
*/
public static final Function toLong(final DecimalPoint decimalPoint) {
return new ToLong(decimalPoint);
}
/**
*
* Converts a String into a Long, using the specified radix for computing the
* equivalent number. The input String must be a valid Long in the given radix
* (i.e. if radix is 5, 34 would be a valid input whereas 34.3 wouldn't as '.' is not allowed)
*
*
* @param radix the radix in which the number is supposedly represented in the String
* @return the resulting Long object
*/
public static final Function toLong(final int radix) {
return new ToLong(Integer.valueOf(radix));
}
/**
*
* Converts a String into a Long, using the default configuration
* for for decimal point and thousands separator. Rounding
* mode is used for removing the decimal part of the number. The
* integer part of the input string must be between
* {@link Long#MIN_VALUE} and {@link Long#MAX_VALUE}
*
*
* @param roundingMode the rounding mode to be used when setting the scale
* @return the resulting Long object
*/
public static final Function toLong(final RoundingMode roundingMode) {
return new ToLong(roundingMode);
}
/**
*
* Converts a String into a Long, using the specified decimal point
* configuration ({@link DecimalPoint}). Rounding mode is used for removing the
* decimal part of the number. The target String should contain no
* thousand separators. The integer part of the input string must be between
* {@link Long#MIN_VALUE} and {@link Long#MAX_VALUE}
*
*
* @param roundingMode the rounding mode to be used when setting the scale
* @param decimalPoint the decimal point being used by the String
* @return the resulting Long object
*/
public static final Function toLong(final RoundingMode roundingMode, final DecimalPoint decimalPoint) {
return new ToLong(roundingMode, decimalPoint);
}
/**
*
* Converts a String into a Long, using the specified locale for determining
* decimal point. Rounding mode is used for removing the
* decimal part of the number. The integer part of the input string must be between
* {@link Long#MIN_VALUE} and {@link Long#MAX_VALUE}
*
*
* @param roundingMode the rounding mode to be used when setting the scale
* @param locale the locale defining the way in which the number was written
* @return the resulting Long object
*/
public static final Function toLong(final RoundingMode roundingMode, final Locale locale) {
return new ToLong(roundingMode, locale);
}
/**
*
* Converts a String into a Long, using the specified locale for determining
* decimal point. Rounding mode is used for removing the
* decimal part of the number. Locale is specified as a String
* (for example: "en_US", "es_ES", etc.). The
* integer part of the input string must be between
* {@link Long#MIN_VALUE} and {@link Long#MAX_VALUE}
*
*
* @param roundingMode the rounding mode to be used when setting the scale
* @param locale the locale defining the way in which the number was written
* @return the resulting Long object
*/
public static final Function toLong(final RoundingMode roundingMode, final String locale) {
return new ToLong(roundingMode, locale);
}
/**
*
* Converts a String into an Integer, using the default
* configuration. The integer part of the input string must be between
* {@link Integer#MIN_VALUE} and {@link Integer#MAX_VALUE}
*
*
* @return the resulting Integer object
*/
public static final Function toInteger() {
return TO_INTEGER;
}
/**
*
* Converts a String into an Integer, using the specified locale for decimal
* point and thousands separator configuration. The
* integer part of the input string must be between
* {@link Integer#MIN_VALUE} and {@link Integer#MAX_VALUE}
*
*
* @param locale the locale defining the way in which the number was written
* @return the resulting Integer object
*/
public static final Function toInteger(final Locale locale) {
return new ToInteger(locale);
}
/**
*
* Converts a String into an Integer, using the specified locale for decimal
* point and thousands separator configuration. Locale is specified as a String
* (for example: "en_US", "es_ES", etc.). The
* integer part of the input string must be between
* {@link Integer#MIN_VALUE} and {@link Integer#MAX_VALUE}
*
*
* @param locale the locale defining the way in which the number was written
* @return the resulting Integer object
*/
public static final Function toInteger(final String locale) {
return new ToInteger(locale);
}
/**
*
* Converts a String into an Integer, using the specified decimal point
* configuration ({@link DecimalPoint}). The target String should contain no
* thousand separators. The integer part of the input string must be between
* {@link Integer#MIN_VALUE} and {@link Integer#MAX_VALUE}
*
*
* @param decimalPoint the decimal point being used by the String
* @return the resulting Integer object
*/
public static final Function toInteger(final DecimalPoint decimalPoint) {
return new ToInteger(decimalPoint);
}
/**
*
* Converts a String into an Integer, using the specified radix for computing the
* equivalent number. The input String must be a valid Integer in the given radix
* (i.e. if radix is 5, 34 would be a valid input whereas 34.3 wouldn't as '.' is not allowed)
*
*
* @param radix the radix in which the number is supposedly represented in the String
* @return the resulting Integer object
*/
public static final Function toInteger(final int radix) {
return new ToInteger(Integer.valueOf(radix));
}
/**
*
* Converts a String into an Integer, using the default configuration
* for for decimal point and thousands separator. Rounding
* mode is used for removing the decimal part of the number. The
* integer part of the input string must be between
* {@link Integer#MIN_VALUE} and {@link Integer#MAX_VALUE}
*
*
* @param roundingMode the rounding mode to be used when setting the scale
* @return the resulting Integer object
*/
public static final Function toInteger(final RoundingMode roundingMode) {
return new ToInteger(roundingMode);
}
/**
*
* Converts a String into an Integer, using the specified decimal point
* configuration ({@link DecimalPoint}). Rounding mode is used for removing the
* decimal part of the number. The target String should contain no
* thousand separators. The integer part of the input string must be between
* {@link Integer#MIN_VALUE} and {@link Integer#MAX_VALUE}
*
*
* @param roundingMode the rounding mode to be used when setting the scale
* @param decimalPoint the decimal point being used by the String
* @return the resulting Integer object
*/
public static final Function toInteger(final RoundingMode roundingMode, final DecimalPoint decimalPoint) {
return new ToInteger(roundingMode, decimalPoint);
}
/**
*
* Converts a String into an Integer, using the specified locale for determining
* decimal point. Rounding mode is used for removing the
* decimal part of the number. The integer part of the input string must be between
* {@link Integer#MIN_VALUE} and {@link Integer#MAX_VALUE}
*
*
* @param roundingMode the rounding mode to be used when setting the scale
* @param locale the locale defining the way in which the number was written
* @return the resulting Integer object
*/
public static final Function toInteger(final RoundingMode roundingMode, final Locale locale) {
return new ToInteger(roundingMode, locale);
}
/**
*
* Converts a String into an Integer, using the specified locale for determining
* decimal point. Rounding mode is used for removing the
* decimal part of the number. Locale is specified as a String
* (for example: "en_US", "es_ES", etc.). The
* integer part of the input string must be between
* {@link Integer#MIN_VALUE} and {@link Integer#MAX_VALUE}
*
*
* @param roundingMode the rounding mode to be used when setting the scale
* @param locale the locale defining the way in which the number was written
* @return the resulting Integer object
*/
public static final Function toInteger(final RoundingMode roundingMode, final String locale) {
return new ToInteger(roundingMode, locale);
}
/**
*
* Converts a String into a Short, using the default configuration.
* The integer part of the input string must be between
* {@link Short#MIN_VALUE} and {@link Short#MAX_VALUE}
*
*
* @return the resulting Short object
*/
public static final Function toShort() {
return TO_SHORT;
}
/**
*
* Converts a String into a Short, using the specified locale for decimal
* point and thousands separator configuration. The
* integer part of the input string must be between
* {@link Short#MIN_VALUE} and {@link Short#MAX_VALUE}
*
*
* @param locale the locale defining the way in which the number was written
* @return the resulting Short object
*/
public static final Function toShort(final Locale locale) {
return new ToShort(locale);
}
/**
*
* Converts a String into a Short, using the specified locale for decimal
* point and thousands separator configuration. Locale is specified as a String
* (for example: "en_US", "es_ES", etc.). The
* integer part of the input string must be between
* {@link Short#MIN_VALUE} and {@link Short#MAX_VALUE}
*
*
* @param locale the locale defining the way in which the number was written
* @return the resulting Short object
*/
public static final Function toShort(final String locale) {
return new ToShort(locale);
}
/**
*
* Converts a String into a Short, using the specified decimal point
* configuration ({@link DecimalPoint}). The target String should contain no
* thousand separators. The integer part of the input string must be between
* {@link Short#MIN_VALUE} and {@link Short#MAX_VALUE}
*
*
* @param decimalPoint the decimal point being used by the String
* @return the resulting Short object
*/
public static final Function toShort(final DecimalPoint decimalPoint) {
return new ToShort(decimalPoint);
}
/**
*
* Converts a String into a Short, using the specified radix for computing the
* equivalent number. The input String must be a valid Short in the given radix
* (i.e. if radix is 5, 34 would be a valid input whereas 34.3 wouldn't as '.' is not allowed)
*
*
* @param radix the radix in which the number is supposedly represented in the String
* @return the resulting Short object
*/
public static final Function toShort(final int radix) {
return new ToShort(Integer.valueOf(radix));
}
/**
*
* Converts a String into a Short, using the default configuration
* for for decimal point and thousands separator. Rounding
* mode is used for removing the decimal part of the number. The
* integer part of the input string must be between
* {@link Short#MIN_VALUE} and {@link Short#MAX_VALUE}
*
*
* @param roundingMode the rounding mode to be used when setting the scale
* @return the resulting Short object
*/
public static final Function toShort(final RoundingMode roundingMode) {
return new ToShort(roundingMode);
}
/**
*
* Converts a String into a Short, using the specified decimal point
* configuration ({@link DecimalPoint}). Rounding mode is used for removing the
* decimal part of the number. The target String should contain no
* thousand separators. The integer part of the input string must be between
* {@link Short#MIN_VALUE} and {@link Short#MAX_VALUE}
*
*
* @param roundingMode the rounding mode to be used when setting the scale
* @param decimalPoint the decimal point being used by the String
* @return the resulting Short object
*/
public static final Function toShort(final RoundingMode roundingMode, final DecimalPoint decimalPoint) {
return new ToShort(roundingMode, decimalPoint);
}
/**
*
* Converts a String into a Short, using the specified locale for determining
* decimal point. Rounding mode is used for removing the
* decimal part of the number. The integer part of the input string must be between
* {@link Short#MIN_VALUE} and {@link Short#MAX_VALUE}
*
*
* @param roundingMode the rounding mode to be used when setting the scale
* @param locale the locale defining the way in which the number was written
* @return the resulting Short object
*/
public static final Function toShort(final RoundingMode roundingMode, final Locale locale) {
return new ToShort(roundingMode, locale);
}
/**
*
* Converts a String into a Short, using the specified locale for determining
* decimal point. Rounding mode is used for removing the
* decimal part of the number. Locale is specified as a String
* (for example: "en_US", "es_ES", etc.). The
* integer part of the input string must be between
* {@link Short#MIN_VALUE} and {@link Short#MAX_VALUE}
*
*
* @param roundingMode the rounding mode to be used when setting the scale
* @param locale the locale defining the way in which the number was written
* @return the resulting Short object
*/
public static final Function toShort(final RoundingMode roundingMode, final String locale) {
return new ToShort(roundingMode, locale);
}
/**
*
* Converts a String into a Byte, using the default configuration.
* Any fractional part of the input String will be removed. The
* integer part of the input string must be between
* {@link Byte#MIN_VALUE} and {@link Byte#MAX_VALUE}
*
*
* @return the resulting Byte object
*/
public static final Function toByte() {
return TO_BYTE;
}
/**
*
* Converts a String into a Byte, using the specified locale for decimal
* point and thousands separator configuration. The
* integer part of the input string must be between
* {@link Byte#MIN_VALUE} and {@link Byte#MAX_VALUE}
*
*
* @param locale the locale defining the way in which the number was written
* @return the resulting Byte object
*/
public static final Function toByte(final Locale locale) {
return new ToByte(locale);
}
/**
*
* Converts a String into a Byte, using the specified locale for decimal
* point and thousands separator configuration. Locale is specified as a String
* (for example: "en_US", "es_ES", etc.). The
* integer part of the input string must be between
* {@link Byte#MIN_VALUE} and {@link Byte#MAX_VALUE}
*
*
* @param locale the locale defining the way in which the number was written
* @return the resulting Byte object
*/
public static final Function toByte(final String locale) {
return new ToByte(locale);
}
/**
*
* Converts a String into a Byte, using the specified decimal point
* configuration ({@link DecimalPoint}). The target String should contain no
* thousand separators. The integer part of the input string must be between
* {@link Byte#MIN_VALUE} and {@link Byte#MAX_VALUE}
*
*
* @param decimalPoint the decimal point being used by the String
* @return the resulting Byte object
*/
public static final Function toByte(final DecimalPoint decimalPoint) {
return new ToByte(decimalPoint);
}
/**
*
* Converts a String into a Byte, using the specified radix for computing the
* equivalent number. The input String must be a valid Byte in the given radix
*
*
* @param radix the radix in which the number is supposedly represented in the String
* @return the resulting Byte object
*/
public static final Function toByte(final int radix) {
return new ToByte(Integer.valueOf(radix));
}
/**
*
* Converts a String into a Byte, using the default configuration
* for for decimal point and thousands separator. Rounding
* mode is used for removing the decimal part of the number.
* The integer part of the input string must be between
* {@link Byte#MIN_VALUE} and {@link Byte#MAX_VALUE}
*
*
* @param roundingMode the rounding mode to be used when setting the scale
* @return the resulting Byte object
*/
public static final Function toByte(final RoundingMode roundingMode) {
return new ToByte(roundingMode);
}
/**
*
* Converts a String into a Byte, using the specified decimal point
* configuration ({@link DecimalPoint}). Rounding mode is used for removing the
* decimal part of the number. The target String should contain no
* thousand separators. The integer part of the input string must be between
* {@link Byte#MIN_VALUE} and {@link Byte#MAX_VALUE}
*
*
* @param roundingMode the rounding mode to be used when setting the scale
* @param decimalPoint the decimal point being used by the String
* @return the resulting Byte object
*/
public static final Function toByte(final RoundingMode roundingMode, final DecimalPoint decimalPoint) {
return new ToByte(roundingMode, decimalPoint);
}
/**
*
* Converts a String into a Byte, using the specified locale for determining
* decimal point. Rounding mode is used for removing the
* decimal part of the number. The integer part of the input string must be between
* {@link Byte#MIN_VALUE} and {@link Byte#MAX_VALUE}
*
*
* @param roundingMode the rounding mode to be used when setting the scale
* @param locale the locale defining the way in which the number was written
* @return the resulting Byte object
*/
public static final Function toByte(final RoundingMode roundingMode, final Locale locale) {
return new ToByte(roundingMode, locale);
}
/**
*
* Converts a String into a Byte, using the specified locale for determining
* decimal point. Rounding mode is used for removing the
* decimal part of the number. Locale is specified as a String
* (for example: "en_US", "es_ES", etc.). The
* integer part of the input string must be between
* {@link Byte#MIN_VALUE} and {@link Byte#MAX_VALUE}
*
*
* @param roundingMode the rounding mode to be used when setting the scale
* @param locale the locale defining the way in which the number was written
* @return the resulting Byte object
*/
public static final Function toByte(final RoundingMode roundingMode, final String locale) {
return new ToByte(roundingMode, locale);
}
/**
*
* Converts a String into a Boolean. Case is ignored, and all three
* "true"/"false", "yes"/"no" and "on"/"off" versions are
* supported.
*
*
* This method calls org.apache.commons.lang.StringUtils.toBooleanObject() .
*
*
* @return the resulting Boolean object
*/
public static final Function toBoolean() {
return TO_BOOLEAN;
}
/**
*
* Turns a String into a value valid for being a CSV column value,
* enclosed in double quotes if needed.
*
*
* This method calls org.apache.commons.lang.StringUtils.escapeCsv() .
* From its definition:
*
*
* If the value contains a comma, newline or double quote, then the
* String value is written enclosed in double quotes.
* Any double quote characters in the value are escaped with another double quote.
* If the value does not contain a comma, newline or double quote, then the
* String value is written unchanged (null values are ignored).
*
*
* @return the resulting String.
*/
public static final Function escapeCSV() {
return ESCAPE_CSV_STRING_FUNC;
}
/**
*
* Removes escaping from a String escaped for a CSV column.
*
*
* This method calls org.apache.commons.lang.StringUtils.unescapeCsv() .
* From its definition:
*
*
* Returns a String
value for an unescaped CSV column.
* If the value is enclosed in double quotes, and contains a comma, newline
* or double quote, then quotes are removed.
* Any double quote escaped characters (a pair of double quotes) are unescaped
* to just one double quote.
* If the value is not enclosed in double quotes, or is and does not contain a
* comma, newline or double quote, then the String value is returned unchanged.
*
*
* @return the resulting String.
*/
public static final Function unescapeCSV() {
return UNESCAPE_CSV_STRING_FUNC;
}
/**
*
* Escapes the characters in a String
using XML entities.
*
*
* This method calls org.apache.commons.lang.StringUtils.escapeXml() .
* From its definition:
*
*
* For example: "bread" & "butter" =>
* "bread" & "butter" .
* Supports only the five basic XML entities (gt, lt, quot, amp, apos).
* Does not support DTDs or external entities.
* Note that unicode characters greater than 0x7f are currently escaped to
* their numerical \\u equivalent. This may change in future releases.
*
*
* @return the resulting String.
*/
public static final Function escapeXML() {
return ESCAPE_XML_STRING_FUNC;
}
/**
*
* Unescapes a string containing XML entity escapes to a string
* containing the actual Unicode characters corresponding to the
* escapes.
*
*
* This method calls org.apache.commons.lang.StringUtils.unescapeXml() .
* From its definition:
*
*
* Supports only the five basic XML entities (gt, lt, quot, amp, apos).
* Does not support DTDs or external entities.
* Note that numerical \\u unicode codes are unescaped to their respective
* unicode characters. This may change in future releases.
*
*
* @return the resulting String.
*/
public static final Function unescapeXML() {
return UNESCAPE_XML_STRING_FUNC;
}
/**
*
* Escapes the characters in a String
using HTML entities.
*
*
* This method calls org.apache.commons.lang.StringUtils.escapeHtml() .
* From its definition:
*
*
* The string "bread" & "butter"
becomes
* "bread" & "butter" .
* Supports all known HTML 4.0 entities, including funky accents.
* Note that the commonly used apostrophe escape character (')
* is not a legal entity and so is not supported).
*
*
* @return the resulting String.
*/
public static final Function escapeHTML() {
return ESCAPE_HTML_STRING_FUNC;
}
/**
*
* Unescapes a string containing entity escapes to a string
* containing the actual Unicode characters corresponding to the
* escapes. Supports HTML 4.0 entities.
*
*
* This method calls org.apache.commons.lang.StringUtils.unescapeHtml() .
* From its definition:
*
*
* The string <Français>
* will become <Français>
* If an entity is unrecognized, it is left alone, and inserted
* verbatim into the result string. e.g. >&zzzz;x will
* become >&zzzz;x .
*
*
* @return the resulting String.
*/
public static final Function unescapeHTML() {
return UNESCAPE_HTML_STRING_FUNC;
}
/**
*
* Escapes the characters in a String
using JavaScript String rules.
*
*
* This method calls org.apache.commons.lang.StringUtils.escapeJavascript() .
* From its definition:
*
*
* Escapes any values it finds into their JavaScript String form.
* Deals correctly with quotes and control-chars (tab, backslash, cr, ff, etc.)
* So a tab becomes the characters '\\'
and 't'
.
* The only difference between Java strings and JavaScript strings
* is that in JavaScript, a single quote must be escaped.
*
*
* Example:
*
* input string: He didn't say, "Stop!"
* output string: He didn\'t say, \"Stop!\"
*
*
* @return the resulting String.
*/
public static final Function escapeJavaScript() {
return ESCAPE_JAVASCRIPT_STRING_FUNC;
}
/**
*
* Unescapes any JavaScript literals found in the String
.
*
*
*
* For example, it will turn a sequence of '\'
and 'n'
* into a newline character, unless the '\'
is preceded by another
* '\'
.
*
*
* This method calls org.apache.commons.lang.StringUtils.unescapeJavascript() .
*
*
* @return the resulting String.
*/
public static final Function unescapeJavaScript() {
return UNESCAPE_JAVASCRIPT_STRING_FUNC;
}
/**
*
* Converts the target String into the Hexadecimal representation of its bytes using the
* specified Charset to obtain them (the bytes).
*
*
* @param charset the charset to be used
* @return the resulting String.
*/
public static final Function toHexadecimal(final Charset charset) {
return new ToHexadecimal(charset);
}
/**
*
* Converts the target String from the Hexadecimal representation of its bytes back into
* a String using the specified Charset.
*
*
* @param charset the charset to be used
* @return the resulting String.
*/
public static final Function fromHexadecimal(final Charset charset) {
return new FromHexadecimal(charset);
}
/**
*
* Converts the target String to upper case.
*
*
* @return the resulting String.
*/
public static final Function toUpperCase() {
return TO_UPPER_CASE_STRING_FUNC;
}
/**
*
* Converts the target String to lower case.
*
*
* @return the resulting String
*/
public static final Function toLowerCase() {
return TO_LOWER_CASE_STRING_FUNC;
}
/**
*
* Converts the first letter of each word in the target String to lowercase
*
*
* @return the resulting String
*/
public static final Function unCapitalize() {
return UN_CAPITALIZE_STRING_FUNC;
}
/**
*
* Converts the first letter of each word in the target String to upper case.
*
*
* @return the resulting String
*/
public static final Function capitalize() {
return CAPITALIZE_STRING_FUNC;
}
/**
*
* Removes control characters (char <= 32) from both ends of the target String.
*
*
* @return the resulting String
*/
public static final Function trim() {
return TRIM_STRING_FUNC;
}
/**
*
* Strips whitespace from both sides of the target String.
*
*
* @return the resulting String
*/
public static final Function strip() {
return STRIP_STRING_FUNC;
}
/**
*
* Checks whether the target String can be converted into a Calendar based on the
* input parameters or not. If it returns true, {@link FnString#toCalendar(String)}
* can be called safely.
*
*
* Pattern format is that of java.text.SimpleDateFormat .
*
*
* @param pattern the pattern to be used
* @return true if the target {@link String} represents a {@link Calendar},
* false otherwise
*/
public static final Function isCalendar(final String pattern) {
return new IsCalendar(pattern);
}
/**
*
* Checks whether the target {@link String} represents a {@link Calendar} or not.
* If it returns true, {@link FnString#toCalendar(String, Locale)} can be called
* safely.
*
*
* Pattern format is that of java.text.SimpleDateFormat .
*
*
* @param pattern the pattern to be used.
* @param locale the locale which will be used for parsing month names
* @return true if the target {@link String} represents a {@link Calendar},
* false otherwise
*/
public static final Function isCalendar(final String pattern, final Locale locale) {
return new IsCalendar(pattern, locale);
}
/**
*
* Returns true if the target {@link String} can be converted into a {@link Calendar}
* based on the input parameters. If it returns true, the function
* {@link ToCalendar#ToCalendar(String, String)} can be called safely.
*
*
* Pattern format is that of java.text.SimpleDateFormat .
*
*
* @param pattern the pattern to be used (ex: "en_US", "es_ES", etc.)
* @param locale the locale which will be used for parsing month names
* @return true if it can be converted, false otherwise
*/
public static final Function isCalendar(final String pattern, final String locale) {
return new IsCalendar(pattern, locale);
}
/**
*
* Converts the target String to a java.util.Calendar by applying the specified
* pattern.
*
*
* Pattern format is that of java.text.SimpleDateFormat .
*
*
* @param pattern the pattern to be used
* @return the resulting Calendar
*/
public static final Function toCalendar(final String pattern) {
return new ToCalendar(pattern);
}
/**
*
* Converts the target String to a java.util.Calendar by applying the specified
* pattern and locale. The locale is needed for correctly parsing month names.
*
*
* Pattern format is that of java.text.SimpleDateFormat .
*
*
* @param pattern the pattern to be used.
* @param locale the locale which will be used for parsing month names
* @return the resulting Calendar
*/
public static final Function toCalendar(final String pattern, final Locale locale) {
return new ToCalendar(pattern, locale);
}
/**
*
* Converts the target String to a java.util.Calendar by applying the specified
* pattern and locale. The locale is needed for correctly parsing month names.
*
*
* Pattern format is that of java.text.SimpleDateFormat .
*
*
* @param pattern the pattern to be used (ex: "en_US", "es_ES", etc.)
* @param locale the locale which will be used for parsing month names
* @return the resulting Calendar
*/
public static final Function toCalendar(final String pattern, final String locale) {
return new ToCalendar(pattern, locale);
}
/**
*
* Converts the target String to a java.util.Date by applying the specified
* pattern.
*
*
* Pattern format is that of java.text.SimpleDateFormat .
*
*
* @param pattern the pattern to be used
* @return the resulting Date
*/
public static final Function toDate(final String pattern) {
return new ToDate(pattern);
}
/**
*
* Converts the target String to a java.util.Date by applying the specified
* pattern and locale. The locale is needed for correctly parsing month names.
*
*
* Pattern format is that of java.text.SimpleDateFormat .
*
*
* @param pattern the pattern to be used.
* @param locale the locale which will be used for parsing month names
* @return the resulting Date
*/
public static final Function toDate(final String pattern, final Locale locale) {
return new ToDate(pattern, locale);
}
/**
*
* Converts the target String to a java.util.Date by applying the specified
* pattern and locale. The locale is needed for correctly parsing month names.
*
*
* Pattern format is that of java.text.SimpleDateFormat .
*
*
* @param pattern the pattern to be used (ex: "en_US", "es_ES", etc.)
* @param locale the locale which will be used for parsing month names
* @return the resulting Date
*/
public static final Function toDate(final String pattern, final String locale) {
return new ToDate(pattern, locale);
}
/**
*
* Performs an equals operation between the target object and the
* specified one.
*
*
* @param object the object that will be passed as a parameter to the "equals" operation.
* @return the boolean result of the "equals" operation.
*/
public static final Function eq(final String object) {
return FnObject.eq(object);
}
/**
*
* Performs an inverse equals operation between the target object and the
* specified one.
*
*
* @param object the object that will be passed as a parameter to the "equals" operation.
* @return the boolean result of the inverse of an "equals" operation.
*/
public static final Function notEq(final String object) {
return FnObject.notEq(object);
}
/**
*
* Determines whether the target object is null or not.
*
*
* @return true if the target object is null, false if not.
*/
public static final Function isNull() {
return FnObject.isNull();
}
/**
*
* Determines whether the target object is null or not.
*
*
* @return false if the target object is null, true if not.
*/
public static final Function isNotNull() {
return FnObject.isNotNull();
}
/**
*
* Determines whether the target object is less than the specified object
* in value, this is, whether target.compareTo(object) < 0 . Both
* the target and the specified object have to implement {@link Comparable}.
*
*
* @param object the object to compare to the target
* @return true if target is less than the specified object, false if not
*/
public static final Function lessThan(final String object) {
return FnObject.lessThan(object);
}
/**
*
* Determines whether the target object is less or equal to the specified object
* in value, this is, whether target.compareTo(object) <= 0 . Both
* the target and the specified object have to implement {@link Comparable}.
*
*
* @param object the object to compare to the target
* @return true if target is less or equal to the specified object, false if not
*/
public static final Function lessOrEqTo(final String object) {
return FnObject.lessOrEqTo(object);
}
/**
*
* Determines whether the target object is greater than the specified object
* in value, this is, whether target.compareTo(object) > 0 . Both
* the target and the specified object have to implement {@link Comparable}.
*
*
* @param object the object to compare to the target
* @return true if target is greater than the specified object, false if not
*/
public static final Function greaterThan(final String object) {
return FnObject.greaterThan(object);
}
/**
*
* Determines whether the target object is greater or equal to the specified object
* in value, this is, whether target.compareTo(object) >= 0 . Both
* the target and the specified object have to implement {@link Comparable}.
*
*
* @param object the object to compare to the target
* @return true if target is greater or equal to the specified object, false if not
*/
public static final Function greaterOrEqTo(final String object) {
return FnObject.greaterOrEqTo(object);
}
/**
*
* Determines whether the target String matches the specified regular
* expression.
*
*
* Regular expressions must conform to the java.util.regex.Pattern format.
*
*
* @param regex the regular expression to match against
* @return true if the target String matches the regex, false if not.
*/
public static final Function matches(final String regex) {
return new Matches(regex);
}
/**
*
* Determines whether the target String contains a fragment matching the specified regular
* expression.
*
*
* Regular expressions must conform to the java.util.regex.Pattern format.
*
*
* @param regex the regular expression to match against
* @return true if the target String contains a fragment matching the regex, false if not.
*/
public static final Function contains(final String regex) {
return new Contains(regex);
}
/**
*
* Extracts the first substring from the target String that matches the specified
* regular expression.
*
*
* Regular expressions must conform to the java.util.regex.Pattern format.
*
*
* @param regex the regular expression to match against
* @return the matching substring.
*/
public static final Function extractFirst(final String regex) {
return new Extract(regex, false);
}
/**
*
* Extracts the last substring from the target String that matches the specified
* regular expression.
*
*
* Regular expressions must conform to the java.util.regex.Pattern format.
*
*
* @param regex the regular expression to match against
* @return the matching substring.
*/
public static final Function extractLast(final String regex) {
return new Extract(regex, true);
}
/**
*
* Extracts every substring from the target String that match the specified
* regular expression.
*
*
* Regular expressions must conform to the java.util.regex.Pattern format.
*
*
* @param regex the regular expression to match against
* @return a List with the matching substrings
*/
public static final Function> extractAll(final String regex) {
return new ExtractAll(regex);
}
/**
*
* Matches the entire target String against the specified regular expression and extracts
* the specified group from it (as specified by java.util.regex.Matcher .
*
*
* Regular expressions must conform to the java.util.regex.Pattern format.
*
*
* @param regex the regular expression to match against
* @param group the group number to be extracted
* @return the substring matching the group number
*/
public static final Function matchAndExtract(final String regex, final int group) {
return new MatchAndExtract(regex, group);
}
/**
*
* Matches the entire target String against the specified regular expression and extracts
* the specified groups from it (as specified by java.util.regex.Matcher .
*
*
* Regular expressions must conform to the java.util.regex.Pattern format.
*
*
* @param regex the regular expression to match against
* @param groups the group numbers to be extracted
* @return a List with the substrings matching the group number
*/
public static final Function> matchAndExtractAll(final String regex, final int... groups) {
return new MatchAndExtractAll(regex, VarArgsUtil.asRequiredIntegerList(groups));
}
/**
*
* Replaces in the target String the first substring matching the specified regular expression
* with the specified replacement String.
*
*
* Regular expressions must conform to the java.util.regex.Pattern format.
*
*
* @param regex the regular expression to match against
* @param replacement the replacement string
* @return the resulting String
*/
public static final Function replaceFirst(final String regex, final String replacement) {
return new Replace(regex, replacement, ReplaceType.FIRST);
}
/**
*
* Replaces in the target String the last substring matching the specified regular expression
* with the specified replacement String.
*
*
* Regular expressions must conform to the java.util.regex.Pattern format.
*
*
* @param regex the regular expression to match against
* @param replacement the replacement string
* @return the resulting String
*/
public static final Function replaceLast(final String regex, final String replacement) {
return new Replace(regex, replacement, ReplaceType.LAST);
}
/**
*
* Replaces in the target String all substrings matching the specified regular expression
* with the specified replacement String.
*
*
* Regular expressions must conform to the java.util.regex.Pattern format.
*
*
* @param regex the regular expression to match against
* @param replacement the replacement string
* @return the resulting String
*/
public static final Function replaceAll(final String regex, final String replacement) {
return new Replace(regex, replacement, ReplaceType.ALL);
}
/**
*
* Splits a String into a list of substrings using a whitespace as a separator.
*
*
* @return a List with the resulting substrings.
*/
public static final Function> split() {
return SPLIT;
}
/**
*
* Splits a String into a list of substrings using the given separator
* as a substrings separator (the separator is not included in the
* elements of the returned list).
*
*
* @param separator the separator to be used
* @return a List with the resulting substrings.
*/
public static final Function> split(final String separator) {
return new Split(separator);
}
/**
*
* Splits a String into an array of substrings using a whitespace as a separator.
*
*
* @return an array with the resulting substrings.
*/
public static final Function splitAsArray() {
return SPLIT_AS_ARRAY;
}
/**
*
* Splits a String into an array of substrings using the given separator
* as a substrings separator (the separator is not included in the
* elements of the returned array).
*
*
* @param separator the separator to be used
* @return an array with the resulting substrings.
*/
public static final Function splitAsArray(final String separator) {
return new SplitAsArray(separator);
}
/**
*
* Joins the string representation of the objects in the list (which might be
* Strings themselves) into a single String (no separator used).
*
*
* @return the resulting String
*/
public static final Function, String> join() {
return JOIN;
}
/**
*
* Joins the string representation of the objects in the list (which might be
* Strings themselves) into a single String using the given separator.
*
*
* @return the resulting String
*/
public static final Function, String> join(String separator) {
return new Join(separator);
}
/**
*
* Joins the string representation of the objects in the array (which might be
* Strings themselves) into a single String (no separator used).
*
*
* @return the resulting String
*/
public static final Function joinArray() {
return JOIN_ARRAY;
}
/**
*
* Joins the string representation of the objects in the array (which might be
* Strings themselves) into a single String using the given separator.
*
*
* @return the resulting String
*/
public static final Function joinArray(String separator) {
return new JoinArray(separator);
}
/**
*
* ASCIIfies a String containing text in (mainly) European languages by removing a set of
* recognized diacritic symbols and performing a number of transformations. Calling this method
* is equivalent to calling {@link #asciify(AsciifyMode)} using the DEFAULT mode.
*
*
*
* @return the transformed String
*/
public static final Function asciify() {
return ASCIIFY;
}
/**
*
* ASCIIfies a String containing text in (mainly) European languages by removing a set of
* recognized diacritic symbols and performing a number of transformations, determined
* by the {@link AsciifyMode} parameter.
*
*
* Transformations for AsciifyMode.DEFAULT are:
*
*
* À, Á, Â, Ã, Ä, Å, \u0100, \u0102, \u0104, \u01CD, \u01FA / à, á, â, ã, ä, å, \u0101, \u0103, \u0105, \u01CE, \u01FB = A / a
* Æ, \u01FC / æ, \u01FD = AE / ae
* Ç, \u0106, \u0108, \u010A, \u010C / ç, \u0107, \u0109, \u010B, \u010D = C / c
* Ð, \u010E, \u0110 / ð, \u010F, \u0111 = D / d
* È, É, Ê, Ë, \u0112, \u0114, \u0116, \u0118, \u011A / è, é, ê, ë, \u0113, \u0115, \u0117, \u0119, \u011B = E / e
* \u011C, \u011E, \u0120, \u0122 / \u011D, \u011F, \u0121, \u0123 = G / g
* \u0124, \u0126 / \u0125, \u0127 = H / h
* Ì, Í, Î, Ï, \u0128, \u012A, \u012C, \u012E, \u0130, \u01CF / ì, í, î, ï, \u0129, \u012B, \u012D, \u012F, \u0131, \u01D0 = I / i
* \u0132 / \u0133 = IJ / ij
* \u0134 / \u0135 = J / j
* \u0136 / \u0137, \u0138 = K / k
* \u0139, \u013B, \u013D, \u013F, \u0141 / \u013A, \u013C, \u013E, \u0140, \u0142 = L / l
* Ñ, \u0143, \u0145, \u0147, \u014A / ñ, \u0144, \u0146, \u0148, \u0149, \u014B = N / n
* Ò, Ó, Ô, Õ, Ö, Ø, \u014C, \u014E, \u0150, \u01A0, \u01D1, \u01FE / ò, ó, ô, õ, ö, ø, \u014D, \u014F, \u0151, \u01A1, \u01D2, \u01FF = O / o
* \u0152 / \u0153 = OE / oe
* \u0154, \u0156, \u0158 / \u0155, \u0157, \u0159 = R / r
* \u015A, \u015C, \u015E, \u0160 / \u015B, \u015D, \u015F, \u0161 = S / s
* ß = "ss" if the preceding character is lower case, "SS" otherwise.
* \u0162, \u0164, \u0166 / \u0163, \u0165, \u0167 = T / t
* Þ / þ = TH / th
* Ù, Ú, Û, Ü, \u0168, \u016A, \u016C, \u016E, \u0170, \u0172, \u01AF, \u01D3, \u01D5, \u01D7, \u01D9, \u01DB / ù, ú, û, ü, \u0169, \u016B, \u016D, \u016F, \u0171, \u0173, \u01B0, \u01D4, \u01D6, \u01D8, \u01DA, \u01DC = U / u
* \u0174 / \u0175 = W / w
* Ý, \u0178, \u0176 / ý, ÿ, \u0177 = Y / y
* \u0179, \u017B, \u017D / \u017A, \u017C, \u017E = Z / z
*
*
* Transformations for AsciifyMode.UMLAUT_E are the same as DEFAULT
* with the following differences:
*
*
* Ä / ä = AE / ae
* Ö / ö = OE / oe
* Ü / ü = UE / ue
*
*
*
* @return the transformed String
*/
public static final Function asciify(final AsciifyMode mode) {
return new Asciify(mode);
}
/**
*
* Checks if a String contains only unicode letters or not
*
*
* @return whether the input String contains only unicode letters or not
*/
public static final Function isAlpha() {
return IS_ALPHA;
}
/**
*
* Checks if a String contains only unicode letters and spaces or not
*
*
* @return true if the input String contains only unicode letters and spaces.
* Otherwise, false
*/
public static final Function isAlphaSpace() {
return IS_ALPHA_SPACE;
}
/**
*
* Checks if a String contains only unicode digits or not
*
*
* @return whether the input String contains only unicode digits or not
*/
public static final Function isNumeric() {
return IS_NUMERIC;
}
/**
*
* Checks if a String contains only unicode digits and spaces or not
*
*
* @return true if the input String contains only unicode digits and spaces.
* Otherwise, false
*/
public static final Function isNumericSpace() {
return IS_NUMERIC_SPACE;
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link BigDecimal}. It uses the default configuration from the JVM (en_US)
* to check whether the string is valid or not.
*
*
* @return true if the input {@link String} represents a valid {@link BigDecimal}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function canBeBigDecimal() {
return CAN_BE_BIG_DECIMAL;
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link BigDecimal} in the given {@link Locale}
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link BigDecimal}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function canBeBigDecimal(final Locale locale) {
return new CanBeBigDecimal(locale);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link BigDecimal} in the given {@link Locale} specified as a {@link String}
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link BigDecimal}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function canBeBigDecimal(final String locale) {
return new CanBeBigDecimal(locale);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link BigDecimal} using the specified decimal point
* configuration ({@link DecimalPoint}).
*
*
* @param decimalPoint the decimal point being used by the String
* @return true if the input {@link String} represents a valid {@link BigDecimal}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function canBeBigDecimal(final DecimalPoint decimalPoint) {
return new CanBeBigDecimal(decimalPoint);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link BigDecimal}. It uses the default configuration from the JVM (en_US)
* to check whether the string is valid or not.
*
*
* @return true if the input {@link String} represents a valid {@link BigDecimal}.
* Otherwise, false
*
* @deprecated use {@link FnString#canBeBigDecimal()} instead. This method will
* be removed in version 1.3
*/
@Deprecated
public static final Function isBigDecimal() {
return CAN_BE_BIG_DECIMAL;
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link BigDecimal} in the given {@link Locale}
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link BigDecimal}.
* Otherwise, false
*
* @deprecated use {@link FnString#canBeBigDecimal(Locale)} instead. This method will
* be removed in version 1.3
*/
@Deprecated
public static final Function isBigDecimal(final Locale locale) {
return new CanBeBigDecimal(locale);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link BigDecimal} in the given {@link Locale} specified as a {@link String}
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link BigDecimal}.
* Otherwise, false
*
* @deprecated use {@link FnString#canBeBigDecimal(String)} instead. This method will
* be removed in version 1.3
*/
@Deprecated
public static final Function isBigDecimal(final String locale) {
return new CanBeBigDecimal(locale);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link BigDecimal} using the specified decimal point
* configuration ({@link DecimalPoint}).
*
*
* @param decimalPoint the decimal point being used by the String
* @return true if the input {@link String} represents a valid {@link BigDecimal}.
* Otherwise, false
*
* @deprecated use {@link FnString#canBeBigDecimal(DecimalPoint)} instead. This method will
* be removed in version 1.3
*/
@Deprecated
public static final Function isBigDecimal(final DecimalPoint decimalPoint) {
return new CanBeBigDecimal(decimalPoint);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link BigDecimal}. It uses the default configuration from the JVM (en_US)
* to check whether the string is valid or not. That is, if it represents either
* a decimal or non decimal number. This function is the same
* as {@link FnString#canBeBigDecimal()}.
*
*
* @return true if the input {@link String} represents a valid {@link BigDecimal}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function isValidBigDecimal() {
return CAN_BE_BIG_DECIMAL;
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link BigDecimal} in the given {@link Locale}. That is, if it
* represents either a decimal or non decimal number. This function is the same
* as {@link FnString#canBeBigDecimal(Locale)}
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link BigDecimal}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function isValidBigDecimal(final Locale locale) {
return new CanBeBigDecimal(locale);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link BigDecimal} in the given {@link Locale} specified as a {@link String}.
* That is, if it represents either a decimal or non decimal number. This
* function is the same as {@link FnString#canBeBigDecimal(String)}
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link BigDecimal}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function isValidBigDecimal(final String locale) {
return new CanBeBigDecimal(locale);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link BigDecimal} using the specified decimal point
* configuration ({@link DecimalPoint}). That is, if it represents either
* a decimal or non decimal number. This function is the same
* as {@link FnString#canBeBigDecimal(DecimalPoint)}.
*
*
* @param decimalPoint the decimal point being used by the String
* @return true if the input {@link String} represents a valid {@link BigDecimal}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function isValidBigDecimal(final DecimalPoint decimalPoint) {
return new CanBeBigDecimal(decimalPoint);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link BigInteger}. It uses the default configuration from the JVM (en_US)
* to check whether the string is valid or not.
*
*
* @return true if the input {@link String} represents a valid {@link BigInteger}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function canBeBigInteger() {
return CAN_BE_BIG_INTEGER;
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link BigInteger} in the given {@link Locale}
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link BigInteger}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function canBeBigInteger(final Locale locale) {
return new CanBeBigInteger(locale);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link BigInteger} in the given {@link Locale} specified as a {@link String}
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link BigInteger}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function canBeBigInteger(final String locale) {
return new CanBeBigInteger(locale);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link BigInteger} using the specified decimal point
* configuration ({@link DecimalPoint}).
*
*
* @param decimalPoint the decimal point being used by the String
* @return true if the input {@link String} represents a valid {@link BigInteger}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function canBeBigInteger(final DecimalPoint decimalPoint) {
return new CanBeBigInteger(decimalPoint);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link BigInteger} in the specified radix. It uses the default
* configuration to check the {@link String}
*
*
* @param radix the radix being used by the String
* @return true if the input {@link String} represents a valid {@link BigInteger}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function canBeBigInteger(final int radix) {
return new CanBeBigInteger(radix);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link BigInteger}. It uses the default configuration from the JVM (en_US)
* to check whether the string is valid or not.
*
*
* @return true if the input {@link String} represents a valid {@link BigInteger}.
* Otherwise, false
*
* @deprecated use {@link FnString#canBeBigInteger()} instead. This method will be
* removed in version 1.3
*/
@Deprecated
public static final Function isBigInteger() {
return CAN_BE_BIG_INTEGER;
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link BigInteger} in the given {@link Locale}
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link BigInteger}.
* Otherwise, false
*
* @deprecated use {@link FnString#canBeBigInteger(Locale)} instead. This method will be
* removed in version 1.3
*/
@Deprecated
public static final Function isBigInteger(final Locale locale) {
return new CanBeBigInteger(locale);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link BigInteger} in the given {@link Locale} specified as a {@link String}
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link BigInteger}.
* Otherwise, false
*
* @deprecated use {@link FnString#canBeBigInteger(String)} instead. This method will be
* removed in version 1.3
*/
@Deprecated
public static final Function isBigInteger(final String locale) {
return new CanBeBigInteger(locale);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link BigInteger} using the specified decimal point
* configuration ({@link DecimalPoint}).
*
*
* @param decimalPoint the decimal point being used by the String
* @return true if the input {@link String} represents a valid {@link BigInteger}.
* Otherwise, false
*
* @deprecated use {@link FnString#canBeBigInteger(DecimalPoint)} instead. This method will be
* removed in version 1.3
*/
@Deprecated
public static final Function isBigInteger(final DecimalPoint decimalPoint) {
return new CanBeBigInteger(decimalPoint);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link BigInteger} in the specified radix. It uses the default
* configuration to check the {@link String}
*
*
* @param radix the radix being used by the String
* @return true if the input {@link String} represents a valid {@link BigInteger}.
* Otherwise, false
*
* @deprecated use {@link FnString#canBeBigInteger(int)} instead. This method will be
* removed in version 1.3
*/
@Deprecated
public static final Function isBigInteger(final int radix) {
return new CanBeBigInteger(radix);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link BigInteger}. That is, if it represents a non decimal number. It uses
* the default configuration from the JVM (en_US)
* to check whether the string is valid or not.
*
*
* @return true if the input {@link String} represents a valid {@link BigInteger}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function isValidBigInteger() {
return IS_VALID_BIG_INTEGER;
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link BigInteger} in the given {@link Locale}.That is, if
* it represents a non decimal number.
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link BigInteger}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function isValidBigInteger(final Locale locale) {
return new IsValidBigInteger(locale);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link BigInteger} in the given {@link Locale} specified as a {@link String}.
* That is, if it represents a non decimal number.
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link BigInteger}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function isValidBigInteger(final String locale) {
return new IsValidBigInteger(locale);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link BigInteger} in the specified radix. It uses the default
* configuration to check the {@link String}. That is, if it
* represents a non decimal number.
*
*
* @param radix the radix being used by the String
* @return true if the input {@link String} represents a valid {@link BigInteger}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function isValidBigInteger(final int radix) {
return new IsValidBigInteger(radix);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Double}. It uses the default configuration from the JVM (en_US)
* to check whether the string is valid or not.
* If this method returns false, {@link FnString#toDouble()} will throw an exception if called.
*
*
* @return true if the input {@link String} represents a valid {@link Double}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function canBeDouble() {
return CAN_BE_DOUBLE;
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Double} in the given {@link Locale}.
* If this method returns false, {@link FnString#toDouble(Locale)} will throw an exception if called.
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link Double}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function canBeDouble(final Locale locale) {
return new CanBeDouble(locale);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Double} in the given {@link Locale} specified as a {@link String}.
* If this method returns false, {@link FnString#toDouble(String)} will throw an exception if called.
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link Double}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function canBeDouble(final String locale) {
return new CanBeDouble(locale);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Double} using the specified decimal point
* configuration ({@link DecimalPoint}).
* If this method returns false, {@link FnString#toDouble(DecimalPoint)} will throw an exception if called.
*
*
* @param decimalPoint the decimal point being used by the String
* @return true if the input {@link String} represents a valid {@link Double}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function canBeDouble(final DecimalPoint decimalPoint) {
return new CanBeDouble(decimalPoint);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Double}. It uses the default configuration from the JVM (en_US)
* to check whether the string is valid or not.
* If this method returns false, {@link FnString#toDouble()} will throw an exception if called.
*
*
* @return true if the input {@link String} represents a valid {@link Double}.
* Otherwise, false
*
* @deprecated use {@link FnString#canBeDouble()} instead. This method will be removed
* in version 1.3
*/
@Deprecated
public static final Function isDouble() {
return CAN_BE_DOUBLE;
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Double} in the given {@link Locale}.
* If this method returns false, {@link FnString#toDouble(Locale)} will throw an exception if called.
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link Double}.
* Otherwise, false
*
* @deprecated use {@link FnString#canBeDouble(Locale)} instead. This method will be removed
* in version 1.3
*/
@Deprecated
public static final Function isDouble(final Locale locale) {
return new CanBeDouble(locale);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Double} in the given {@link Locale} specified as a {@link String}.
* If this method returns false, {@link FnString#toDouble(String)} will throw an exception if called.
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link Double}.
* Otherwise, false
*
* @deprecated use {@link FnString#canBeDouble(String)} instead. This method will be removed
* in version 1.3
*/
@Deprecated
public static final Function isDouble(final String locale) {
return new CanBeDouble(locale);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Double} using the specified decimal point
* configuration ({@link DecimalPoint}).
* If this method returns false, {@link FnString#toDouble(DecimalPoint)} will throw an exception if called.
*
*
* @param decimalPoint the decimal point being used by the String
* @return true if the input {@link String} represents a valid {@link Double}.
* Otherwise, false
*
* @deprecated use {@link FnString#canBeDouble(DecimalPoint)} instead. This method will be removed
* in version 1.3
*/
@Deprecated
public static final Function isDouble(final DecimalPoint decimalPoint) {
return new CanBeDouble(decimalPoint);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Double}. It uses the default configuration from the JVM (en_US)
* to check whether the string is valid or not.
* That is, if it represents either a decimal or non decimal number that fits
* in a {@link Double} number. This function is the same
* as {@link FnString#canBeDouble()}
*
*
* @return true if the input {@link String} represents a valid {@link Double}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function isValidDouble() {
return CAN_BE_DOUBLE;
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Double} in the given {@link Locale}.
* That is, if it represents either a decimal or non decimal number that fits
* in a {@link Double} number. This function is the same
* as {@link FnString#canBeDouble(Locale)}
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link Double}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function isValidDouble(final Locale locale) {
return new CanBeDouble(locale);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Double} in the given {@link Locale} specified as a {@link String}.
* That is, if it represents either a decimal or non decimal number that fits
* in a {@link Double} number. This function is the same
* as {@link FnString#canBeDouble(String)}
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link Double}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function isValidDouble(final String locale) {
return new CanBeDouble(locale);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Double} using the specified decimal point
* configuration ({@link DecimalPoint}).
* That is, if it represents either a decimal or non decimal number that fits
* in a {@link Double} number. This function is the same
* as {@link FnString#canBeDouble(DecimalPoint)}
*
*
* @param decimalPoint the decimal point being used by the String
* @return true if the input {@link String} represents a valid {@link Double}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function isValidDouble(final DecimalPoint decimalPoint) {
return new CanBeDouble(decimalPoint);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Float}. It uses the default configuration from the JVM (en_US)
* to check whether the string is valid or not.
* If this method returns false, {@link FnString#toFloat()} will throw an exception if called.
*
*
* @return true if the input {@link String} represents a valid {@link Float}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function canBeFloat() {
return CAN_BE_FLOAT;
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Float} in the given {@link Locale}.
* If this method returns false, {@link FnString#toFloat(Locale)} will throw an exception if called.
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link Float}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function canBeFloat(final Locale locale) {
return new CanBeFloat(locale);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Float} in the given {@link Locale} specified as a {@link String}.
* If this method returns false, {@link FnString#toFloat(String)} will throw an exception if called.
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link Float}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function canBeFloat(final String locale) {
return new CanBeFloat(locale);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Float} using the specified decimal point
* configuration ({@link DecimalPoint}).
* If this method returns false, {@link FnString#toFloat(DecimalPoint)} will throw an exception if called.
*
*
* @param decimalPoint the decimal point being used by the String
* @return true if the input {@link String} represents a valid {@link Float}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function canBeFloat(final DecimalPoint decimalPoint) {
return new CanBeFloat(decimalPoint);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Float}. It uses the default configuration from the JVM (en_US)
* to check whether the string is valid or not.
* If this method returns false, {@link FnString#toFloat()} will throw an exception if called.
*
*
* @return true if the input {@link String} represents a valid {@link Float}.
* Otherwise, false
*
* @deprecated use {@link FnString#canBeFloat()} instead. This method will be removed in
* version 1.3
*/
@Deprecated
public static final Function isFloat() {
return CAN_BE_FLOAT;
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Float} in the given {@link Locale}.
* If this method returns false, {@link FnString#toFloat(Locale)} will throw an exception if called.
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link Float}.
* Otherwise, false
*
* @deprecated use {@link FnString#canBeFloat(Locale)} instead. This method will be removed in
* version 1.3
*/
@Deprecated
public static final Function isFloat(final Locale locale) {
return new CanBeFloat(locale);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Float} in the given {@link Locale} specified as a {@link String}.
* If this method returns false, {@link FnString#toFloat(String)} will throw an exception if called.
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link Float}.
* Otherwise, false
*
* @deprecated use {@link FnString#canBeFloat(String)} instead. This method will be removed in
* version 1.3
*/
@Deprecated
public static final Function isFloat(final String locale) {
return new CanBeFloat(locale);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Float} using the specified decimal point
* configuration ({@link DecimalPoint}).
* If this method returns false, {@link FnString#toFloat(DecimalPoint)} will throw an exception if called.
*
*
* @param decimalPoint the decimal point being used by the String
* @return true if the input {@link String} represents a valid {@link Float}.
* Otherwise, false
*
* @deprecated use {@link FnString#canBeFloat(DecimalPoint)} instead. This method will be removed in
* version 1.3
*/
@Deprecated
public static final Function isFloat(final DecimalPoint decimalPoint) {
return new CanBeFloat(decimalPoint);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Float}. It uses the default configuration from the JVM (en_US)
* to check whether the string is valid or not.
* That is, if it represents either a decimal or non decimal number that fits
* in a {@link Float} number. This function is the same
* as {@link FnString#canBeFloat()}
*
*
* @return true if the input {@link String} represents a valid {@link Float}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function isValidFloat() {
return CAN_BE_FLOAT;
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Float} in the given {@link Locale}.
* That is, if it represents either a decimal or non decimal number that
* fits in a {@link Float} number. This function is the
* same as {@link FnString#canBeFloat(Locale)}
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link Float}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function isValidFloat(final Locale locale) {
return new CanBeFloat(locale);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Float} in the given {@link Locale} specified as a {@link String}.
* That is, if it represents either a decimal or non decimal number
* that fits in a {@link Float} number.
* This function is the same as {@link FnString#canBeFloat(String)}
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link Float}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function isValidFloat(final String locale) {
return new CanBeFloat(locale);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Float} using the specified decimal point
* configuration ({@link DecimalPoint}). That is, if it represents either a
* decimal or non decimal number that fits in a {@link Float} number.
* This function is the same as {@link FnString#canBeFloat(DecimalPoint)}.
*
*
* @param decimalPoint the decimal point being used by the String
* @return true if the input {@link String} represents a valid {@link Float}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function isValidFloat(final DecimalPoint decimalPoint) {
return new CanBeFloat(decimalPoint);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Long}. It uses the default configuration from the JVM (en_US)
* to check whether the string is valid or not.
* If this method returns false, {@link FnString#toLong()} will throw an exception if called.
*
*
* @return true if the input {@link String} represents a valid {@link Long}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function canBeLong() {
return CAN_BE_LONG;
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Long} in the given {@link Locale}.
* If this method returns false, {@link FnString#toLong(Locale)} will throw an exception if called.
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link Long}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function canBeLong(final Locale locale) {
return new CanBeLong(locale);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Long} in the given {@link Locale} specified as a {@link String}.
* If this method returns false, {@link FnString#toLong(String)} will throw an exception if called.
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link Long}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function canBeLong(final String locale) {
return new CanBeLong(locale);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Long} using the specified decimal point
* configuration ({@link DecimalPoint}).
* If this method returns false, {@link FnString#toLong(DecimalPoint)} will throw an exception if called.
*
*
* @param decimalPoint the decimal point being used by the String
* @return true if the input {@link String} represents a valid {@link Long}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function canBeLong(final DecimalPoint decimalPoint) {
return new CanBeLong(decimalPoint);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Long} in the specified radix. It uses the default
* configuration to check the {@link String}.
* If this method returns false, {@link FnString#toLong(int)} will throw an exception if called.
*
*
* @param radix the radix being used by the String
* @return true if the input {@link String} represents a valid {@link Long}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function canBeLong(final int radix) {
return new CanBeLong(radix);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Long}. It uses the default configuration from the JVM (en_US)
* to check whether the string is valid or not.
* If this method returns false, {@link FnString#toLong()} will throw an exception if called.
*
*
* @return true if the input {@link String} represents a valid {@link Long}.
* Otherwise, false
*
* @deprecated use {@link FnString#canBeLong()} instead. This method will be removed in
* version 1.3
*/
@Deprecated
public static final Function isLong() {
return CAN_BE_LONG;
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Long} in the given {@link Locale}.
* If this method returns false, {@link FnString#toLong(Locale)} will throw an exception if called.
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link Long}.
* Otherwise, false
*
* @deprecated use {@link FnString#canBeLong(Locale)} instead. This method will be removed in
* version 1.3
*/
@Deprecated
public static final Function isLong(final Locale locale) {
return new CanBeLong(locale);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Long} in the given {@link Locale} specified as a {@link String}.
* If this method returns false, {@link FnString#toLong(String)} will throw an exception if called.
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link Long}.
* Otherwise, false
*
* @deprecated use {@link FnString#canBeLong(String)} instead. This method will be removed in
* version 1.3
*/
@Deprecated
public static final Function isLong(final String locale) {
return new CanBeLong(locale);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Long} using the specified decimal point
* configuration ({@link DecimalPoint}).
* If this method returns false, {@link FnString#toLong(DecimalPoint)} will throw an exception if called.
*
*
* @param decimalPoint the decimal point being used by the String
* @return true if the input {@link String} represents a valid {@link Long}.
* Otherwise, false
*
* @deprecated use {@link FnString#canBeLong(DecimalPoint)} instead. This method will be removed in
* version 1.3
*/
@Deprecated
public static final Function isLong(final DecimalPoint decimalPoint) {
return new CanBeLong(decimalPoint);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Long} in the specified radix. It uses the default
* configuration to check the {@link String}.
* If this method returns false, {@link FnString#toLong(int)} will throw an exception if called.
*
*
* @param radixthe radix being used by the String
* @return true if the input {@link String} represents a valid {@link Long}.
* Otherwise, false
*
* @deprecated use {@link FnString#canBeLong(int)} instead. This method will be removed in
* version 1.3
*/
@Deprecated
public static final Function isLong(final int radix) {
return new CanBeLong(radix);
}
/**
*
* Returns true if the input {@link String} represents an {@link Long},
* that is, it it represents a non decimal number between
* {@link Long#MIN_VALUE} and {@link Long#MAX_VALUE}.
*
*
* @return true if the input {@link String} represents a valid {@link Long}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function isValidLong() {
return IS_VALID_LONG;
}
/**
*
* Returns true if the input {@link String} represents an {@link Long},
* that is, it it represents a non decimal number between
* {@link Long#MIN_VALUE} and {@link Long#MAX_VALUE}.
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link Long}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function isValidLong(final Locale locale) {
return new IsValidLong(locale);
}
/**
*
* Returns true if the input {@link String} represents an {@link Long},
* that is, it it represents a non decimal number between
* {@link Long#MIN_VALUE} and {@link Long#MAX_VALUE}.
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link Long}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function isValidLong(final String locale) {
return new IsValidLong(locale);
}
/**
*
* Returns true if the input {@link String} represents an {@link Long},
* that is, it it represents a non decimal number between
* {@link Long#MIN_VALUE} and {@link Long#MAX_VALUE}. It uses the default
* configuration to check the {@link String}.
*
*
* @param radix the radix being used by the String
* @return true if the input {@link String} represents a valid {@link Long}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function isValidLong(final int radix) {
return new IsValidLong(radix);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Integer}. It uses the default configuration from the JVM (en_US)
* to check whether the string is valid or not.
* If this method returns false, {@link FnString#toInteger()} will throw an exception if called.
*
*
* @return true if the input {@link String} represents a valid {@link Integer}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function canBeInteger() {
return CAN_BE_INTEGER;
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Integer} in the given {@link Locale}.
* If this method returns false, {@link FnString#toInteger(Locale)} will throw an exception if called.
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link Integer}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function canBeInteger(final Locale locale) {
return new CanBeInteger(locale);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Integer} in the given {@link Locale} specified as a {@link String}.
* If this method returns false, {@link FnString#toInteger(String)} will throw an exception if called.
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link Integer}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function canBeInteger(final String locale) {
return new CanBeInteger(locale);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Integer} using the specified decimal point
* configuration ({@link DecimalPoint}).
* If this method returns false, {@link FnString#toInteger(DecimalPoint)} will throw an exception if called.
*
*
* @param decimalPoint the decimal point being used by the String
* @return true if the input {@link String} represents a valid {@link Integer}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function canBeInteger(final DecimalPoint decimalPoint) {
return new CanBeInteger(decimalPoint);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Integer} in the specified radix. It uses the default
* configuration to check the {@link String}.
* If this method returns false, {@link FnString#toInteger(int)} will throw an exception if called.
*
*
* @param radix the radix being used by the String
* @return true if the input {@link String} represents a valid {@link Integer}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function canBeInteger(final int radix) {
return new CanBeInteger(radix);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Integer}. It uses the default configuration from the JVM (en_US)
* to check whether the string is valid or not.
* If this method returns false, {@link FnString#toInteger()} will throw an exception if called.
*
*
* @return true if the input {@link String} represents a valid {@link Integer}.
* Otherwise, false
*
* @deprecated use {@link FnString#canBeInteger()} instead. This method will be
* removed in version 1.3
*/
@Deprecated
public static final Function isInteger() {
return CAN_BE_INTEGER;
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Integer} in the given {@link Locale}.
* If this method returns false, {@link FnString#toInteger(Locale)} will throw an exception if called.
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link Integer}.
* Otherwise, false
*
* @deprecated use {@link FnString#canBeInteger(Locale)} instead. This method will be
* removed in version 1.3
*/
@Deprecated
public static final Function isInteger(final Locale locale) {
return new CanBeInteger(locale);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Integer} in the given {@link Locale} specified as a {@link String}.
* If this method returns false, {@link FnString#toInteger(String)} will throw an exception if called.
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link Integer}.
* Otherwise, false
*
* @deprecated use {@link FnString#canBeInteger(String)} instead. This method will be
* removed in version 1.3
*/
@Deprecated
public static final Function isInteger(final String locale) {
return new CanBeInteger(locale);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Integer} using the specified decimal point
* configuration ({@link DecimalPoint}).
* If this method returns false, {@link FnString#toInteger(DecimalPoint)} will throw an exception if called.
*
*
* @param decimalPoint the decimal point being used by the String
* @return true if the input {@link String} represents a valid {@link Integer}.
* Otherwise, false
*
* @deprecated use {@link FnString#canBeInteger(DecimalPoint)} instead. This method will be
* removed in version 1.3
*/
@Deprecated
public static final Function isInteger(final DecimalPoint decimalPoint) {
return new CanBeInteger(decimalPoint);
}
/**
*
* Returns true if the input {@link String} can be converted into a
* valid {@link Integer} in the specified radix. It uses the default
* configuration to check the {@link String}.
* If this method returns false, {@link FnString#toInteger(int)} will throw an exception if called.
*
*
* @param radix the radix being used by the String
* @return true if the input {@link String} represents a valid {@link Integer}.
* Otherwise, false
*
* @deprecated use {@link FnString#canBeInteger(int)} instead. This method will be
* removed in version 1.3
*/
@Deprecated
public static final Function isInteger(final int radix) {
return new CanBeInteger(radix);
}
/**
*
* Returns true if the input {@link String} represents an {@link Integer},
* that is, it it represents a non decimal number between
* {@link Integer#MIN_VALUE} and {@link Integer#MAX_VALUE}.
*
*
* @return true if the input {@link String} represents a valid {@link Integer}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function isValidInteger() {
return IS_VALID_INTEGER;
}
/**
*
* Returns true if the input {@link String} represents an {@link Integer},
* that is, it it represents a non decimal number between
* {@link Integer#MIN_VALUE} and {@link Integer#MAX_VALUE}.
*
*
* @param locale the locale defining the way in which the number is written
* @return true if the input {@link String} represents a valid {@link Integer}.
* Otherwise, false
*
* @since 1.2
*/
public static final Function isValidInteger(final Locale locale) {
return new IsValidInteger(locale);
}
/**
*