FnString is a function hub class containing a lot of static methods returning functions that take a String object as its input. It includes conversions to numbers, calendar and escape functions among others.
| Function name | Type | Params | Description |
|---|---|---|---|
| asciify | Function<String,String> | 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 asciify(AsciifyMode) using the DEFAULT mode. | |
| asciify | Function<String,String> | AsciifyMode mode | 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 AsciifyMode parameter. Transformations for AsciifyMode.DEFAULT are:
Transformations for AsciifyMode.UMLAUT_E are the same as DEFAULT with the following differences:
|
| capitalize | Function<String,String> | Converts the first letter of each word in the target String to upper case. | |
| contains | Function<String,Boolean> | String 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. |
| eq | Function<Object,Boolean> | String object | Performs an equals operation between the target object and the specified one. |
| escapeCSV | Function<String,String> | 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:
| |
| escapeHTML | Function<String,String> | Escapes the characters in a String using HTML entities. This method calls org.apache.commons.lang.StringUtils.escapeHtml(). From its definition:
| |
| escapeJavaScript | Function<String,String> | Escapes the characters in a String using JavaScript String rules. This method calls org.apache.commons.lang.StringUtils.escapeJavascript(). From its definition:
Example:
| |
| escapeXML | Function<String,String> | Escapes the characters in a String using XML entities. This method calls org.apache.commons.lang.StringUtils.escapeXml(). From its definition:
| |
| extractAll | Function<String,List<String>> | String regex | Extracts every substring from the target String that match the specified regular expression. Regular expressions must conform to the java.util.regex.Pattern format. |
| extractFirst | Function<String,String> | String 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. |
| extractLast | Function<String,String> | String regex | 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. |
| fromHexadecimal | Function<String,String> | Charset charset | Converts the target String from the Hexadecimal representation of its bytes back into a String using the specified Charset. |
| greaterOrEqTo | Function<Object,Boolean> | String object | Returns whether the target object is greater or equal (using natural order, which is alphabetic for strings) to the specified object. |
| greaterThan | Function<Object,Boolean> | String object | Returns whether the target object is greater (using natural order, which is alphabetic for strings) than the specified object. |
| isNotNull | Function<Object,Boolean> | Returns whether the target object is null or not (true = no). | |
| isNull | Function<Object,Boolean> | Returns whether the target object is null or not (true = yes). | |
| join | Function<List<Object>, String> | Joins the string representation of the objects in the list (which might be Strings themselves) into a single String (no separator used). | |
| join | Function<List<Object>, String> | String separator | Joins the string representation of the objects in the list (which might be Strings themselves) into a single String using the given separator. |
| joinArray | Function<Object[], String> | Joins the string representation of the objects in the array (which might be Strings themselves) into a single String (no separator used). | |
| joinArray | Function<Object[], String> | String separator | Joins the string representation of the objects in the array (which might be Strings themselves) into a single String using the given separator. |
| lessOrEqTo | Function<Object,Boolean> | String object | Returns whether the target object is less or equal (using natural order, which is alphabetic for strings) to the specified object. |
| lessThan | Function<Object,Boolean> | String object | Returns whether the target object is less (using natural order, which is alphabetic for strings) than the specified object. |
| matchAndExtract | Function<String,String> | String regex int group | 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. |
| matchAndExtractAll | Function<String,List<String>> | String regex int... groups | 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. |
| matches | Function<String,Boolean> | String regex | Determines whether the target String matches the specified regular expression. Regular expressions must conform to the java.util.regex.Pattern format. |
| notEq | Function<Object,Boolean> | String object | Performs an inverse equals operation between the target object and the specified one. |
| replaceAll | Function<String,String> | String regex String replacement | 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. |
| replaceFirst | Function<String,String> | String regex String replacement | 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. |
| replaceLast | Function<String,String> | String regex String replacement | 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. |
| split | Function<String, List<String>> | Splits a String into a list of substrings using a whitespace as a separator. | |
| split | Function<String, List<String>> | String separator | 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). |
| splitAsArray | Function<String, String[]> | Splits a String into an array of substrings using a whitespace as a separator. | |
| splitAsArray | Function<String, String[]> | String separator | 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). |
| strip | Function<String,String> | Strips whitespace from both sides of the target String. | |
| toBigDecimal | Function<String,BigDecimal> | Converts a String into a BigDecimal, using the default configuration for for decimal point and precision. | |
| toBigDecimal | Function<String,BigDecimal> | Locale locale | Converts a String into a BigDecimal, using the specified locale for decimal point and thousands separator configuration. |
| toBigDecimal | Function<String,BigDecimal> | String 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.) |
| toBigDecimal | Function<String,BigDecimal> | DecimalPoint decimalPoint | Converts a String into a BigDecimal, using the specified decimal point configuration ( DecimalPoint). The target String should contain no thousand separators. |
| toBigDecimal | Function<String,BigDecimal> | int scale RoundingMode roundingMode | 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. |
| toBigDecimal | Function<String,BigDecimal> | int scale RoundingMode roundingMode Locale 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. |
| toBigDecimal | Function<String,BigDecimal> | int scale RoundingMode roundingMode String 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.) |
| toBigDecimal | Function<String,BigDecimal> | int scale RoundingMode roundingMode DecimalPoint decimalPoint | Converts a String into a BigDecimal, using the specified decimal point configuration ( 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. |
| toBigInteger | Function<String,BigInteger> | Converts a String into a BigInteger, using the default configuration. | |
| toBigInteger | Function<String,BigInteger> | Locale locale | Converts a String into a BigInteger, using the specified locale for decimal point and thousands separator configuration. |
| toBigInteger | Function<String,BigInteger> | String 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.) |
| toBigInteger | Function<String,BigInteger> | DecimalPoint decimalPoint | Converts a String into a BigInteger, using the specified decimal point configuration ( DecimalPoint). The target String should contain no thousand separators. |
| toBigInteger | Function<String,BigInteger> | int radix | Converts a String into a BigInteger, using the specified radix for computing the equivalent number. |
| toBigInteger | Function<String,BigInteger> | RoundingMode roundingMode | 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. |
| toBigInteger | Function<String,BigInteger> | RoundingMode roundingMode DecimalPoint decimalPoint | Converts a String into a BigInteger, using the specified decimal point configuration ( DecimalPoint). Rounding mode is used for removing the decimal part of the number. The target String should contain no thousand separators. |
| toBigInteger | Function<String,BigInteger> | RoundingMode roundingMode Locale 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. |
| toBigInteger | Function<String,BigInteger> | RoundingMode roundingMode String 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.) |
| toBoolean | Function<String,Boolean> | 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(). | |
| toByte | Function<String,Byte> | Converts a String into a Byte, using the default configuration. | |
| toByte | Function<String,Byte> | Locale locale | Converts a String into a Byte, using the specified locale for decimal point and thousands separator configuration. |
| toByte | Function<String,Byte> | String 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.) |
| toByte | Function<String,Byte> | DecimalPoint decimalPoint | Converts a String into a Byte, using the specified decimal point configuration ( DecimalPoint). The target String should contain no thousand separators. |
| toByte | Function<String,Byte> | int radix | Converts a String into a Byte, using the specified radix for computing the equivalent number. |
| toByte | Function<String,Byte> | RoundingMode roundingMode | 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. |
| toByte | Function<String,Byte> | RoundingMode roundingMode DecimalPoint decimalPoint | Converts a String into a Byte, using the specified decimal point configuration ( DecimalPoint). Rounding mode is used for removing the decimal part of the number. The target String should contain no thousand separators. |
| toByte | Function<String,Byte> | RoundingMode roundingMode Locale 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. |
| toByte | Function<String,Byte> | RoundingMode roundingMode String 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.) |
| toCalendar | Function<String,Calendar> | String pattern | Converts the target String to a java.util.Calendar by applying the specified pattern. Pattern format is that of java.text.SimpleDateFormat. |
| toCalendar | Function<String,Calendar> | String pattern Locale 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. |
| toCalendar | Function<String,Calendar> | String pattern String 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. |
| toDate | Function<String,Date> | String pattern | Converts the target String to a java.util.Date by applying the specified pattern. Pattern format is that of java.text.SimpleDateFormat. |
| toDate | Function<String,Date> | String pattern Locale 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. |
| toDate | Function<String,Date> | String pattern String 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. |
| toDouble | Function<String,Double> | Converts a String into a Double, using the default configuration for for decimal point and precision. | |
| toDouble | Function<String,Double> | Locale locale | Converts a String into a Double, using the specified locale for decimal point and thousands separator configuration. |
| toDouble | Function<String,Double> | String 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.) |
| toDouble | Function<String,Double> | DecimalPoint decimalPoint | Converts a String into a Double, using the specified decimal point configuration ( DecimalPoint). The target String should contain no thousand separators. |
| toDouble | Function<String,Double> | int scale RoundingMode roundingMode | 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. |
| toDouble | Function<String,Double> | int scale RoundingMode roundingMode Locale 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. |
| toDouble | Function<String,Double> | int scale RoundingMode roundingMode String 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.) |
| toDouble | Function<String,Double> | int scale RoundingMode roundingMode DecimalPoint decimalPoint | Converts a String into a Double, using the specified decimal point configuration ( 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. |
| toFloat | Function<String,Float> | Converts a String into a Float, using the default configuration for for decimal point and precision. | |
| toFloat | Function<String,Float> | Locale locale | Converts a String into a Float, using the specified locale for decimal point and thousands separator configuration. |
| toFloat | Function<String,Float> | String 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.) |
| toFloat | Function<String,Float> | DecimalPoint decimalPoint | Converts a String into a Float, using the specified decimal point configuration ( DecimalPoint). The target String should contain no thousand separators. |
| toFloat | Function<String,Float> | int scale RoundingMode roundingMode | 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. |
| toFloat | Function<String,Float> | int scale RoundingMode roundingMode Locale 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. |
| toFloat | Function<String,Float> | int scale RoundingMode roundingMode String 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.) |
| toFloat | Function<String,Float> | int scale RoundingMode roundingMode DecimalPoint decimalPoint | Converts a String into a Float, using the specified decimal point configuration ( 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. |
| toHexadecimal | Function<String,String> | Charset charset | Converts the target String into the Hexadecimal representation of its bytes using the specified Charset to obtain them (the bytes). |
| toInteger | Function<String,Integer> | Converts a String into an Integer, using the default configuration. | |
| toInteger | Function<String,Integer> | Locale locale | Converts a String into an Integer, using the specified locale for decimal point and thousands separator configuration. |
| toInteger | Function<String,Integer> | String 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.) |
| toInteger | Function<String,Integer> | DecimalPoint decimalPoint | Converts a String into an Integer, using the specified decimal point configuration ( DecimalPoint). The target String should contain no thousand separators. |
| toInteger | Function<String,Integer> | int radix | Converts a String into an Integer, using the specified radix for computing the equivalent number. |
| toInteger | Function<String,Integer> | RoundingMode roundingMode | 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. |
| toInteger | Function<String,Integer> | RoundingMode roundingMode DecimalPoint decimalPoint | Converts a String into an Integer, using the specified decimal point configuration ( DecimalPoint). Rounding mode is used for removing the decimal part of the number. The target String should contain no thousand separators. |
| toInteger | Function<String,Integer> | RoundingMode roundingMode Locale 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. |
| toInteger | Function<String,Integer> | RoundingMode roundingMode String 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.) |
| toLong | Function<String,Long> | Converts a String into a Long, using the default configuration. | |
| toLong | Function<String,Long> | Locale locale | Converts a String into a Long, using the specified locale for decimal point and thousands separator configuration. |
| toLong | Function<String,Long> | String 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.) |
| toLong | Function<String,Long> | DecimalPoint decimalPoint | Converts a String into a Long, using the specified decimal point configuration ( DecimalPoint). The target String should contain no thousand separators. |
| toLong | Function<String,Long> | int radix | Converts a String into a Long, using the specified radix for computing the equivalent number. |
| toLong | Function<String,Long> | RoundingMode roundingMode | 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. |
| toLong | Function<String,Long> | RoundingMode roundingMode DecimalPoint decimalPoint | Converts a String into a Long, using the specified decimal point configuration ( DecimalPoint). Rounding mode is used for removing the decimal part of the number. The target String should contain no thousand separators. |
| toLong | Function<String,Long> | RoundingMode roundingMode Locale 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. |
| toLong | Function<String,Long> | RoundingMode roundingMode String 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.) |
| toLowerCase | Function<String,String> | Converts the target String to lower case. | |
| toShort | Function<String,Short> | Converts a String into a Short, using the default configuration. | |
| toShort | Function<String,Short> | Locale locale | Converts a String into a Short, using the specified locale for decimal point and thousands separator configuration. |
| toShort | Function<String,Short> | String 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.) |
| toShort | Function<String,Short> | DecimalPoint decimalPoint | Converts a String into a Short, using the specified decimal point configuration ( DecimalPoint). The target String should contain no thousand separators. |
| toShort | Function<String,Short> | int radix | Converts a String into a Short, using the specified radix for computing the equivalent number. |
| toShort | Function<String,Short> | RoundingMode roundingMode | 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. |
| toShort | Function<String,Short> | RoundingMode roundingMode DecimalPoint decimalPoint | Converts a String into a Short, using the specified decimal point configuration ( DecimalPoint). Rounding mode is used for removing the decimal part of the number. The target String should contain no thousand separators. |
| toShort | Function<String,Short> | RoundingMode roundingMode Locale 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. |
| toShort | Function<String,Short> | RoundingMode roundingMode String 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.) |
| toUpperCase | Function<String,String> | Converts the target String to upper case. | |
| trim | Function<String,String> | Removes control characters (char <= 32) from both ends of the target String. | |
| unCapitalize | Function<String,String> | Converts the first letter of each word in the target String to lowercase | |
| unescapeCSV | Function<String,String> | Removes escaping from a String escaped for a CSV column. This method calls org.apache.commons.lang.StringUtils.unescapeCsv(). From its definition:
| |
| unescapeHTML | Function<String,String> | 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:
| |
| unescapeJavaScript | Function<String,String> | 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(). | |
| unescapeXML | Function<String,String> | 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:
| |