Package org.apache.fop.util
Class ConversionUtils
- java.lang.Object
-
- org.apache.fop.util.ConversionUtils
-
public final class ConversionUtils extends java.lang.ObjectThis class contains utility methods for conversions, like a java.lang.String to an array of int or double.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static double[]toDoubleArray(java.lang.String baseString, java.lang.String separatorPattern)Converts the given baseStringinto an array ofdouble, splitting the base along the given separator pattern.static int[]toIntArray(java.lang.String baseString, java.lang.String separatorPattern)Converts the given baseStringinto an array ofint, splitting the base along the given separator pattern.
-
-
-
Method Detail
-
toIntArray
public static int[] toIntArray(java.lang.String baseString, java.lang.String separatorPattern)Converts the given baseStringinto an array ofint, splitting the base along the given separator pattern. Note: this method assumes the input is a string containing only decimal integers, signed or unsigned, that are parsable byjava.lang.Integer.parseInt(String). If this is not the case, the resultingNumberFormatExceptionwill have to be handled by the caller.- Parameters:
baseString- the base stringseparatorPattern- the pattern separating the integer values (if this isnull, the baseString is parsed as one integer value)- Returns:
- an array of
intwhose size is equal to the number values in the input string;nullif this number is equal to zero.
-
toDoubleArray
public static double[] toDoubleArray(java.lang.String baseString, java.lang.String separatorPattern)Converts the given baseStringinto an array ofdouble, splitting the base along the given separator pattern. Note: this method assumes the input is a string containing only decimal doubles, signed or unsigned, that are parsable byjava.lang.Double.parseDouble(String). If this is not the case, the resultingNumberFormatExceptionwill have to be handled by the caller.- Parameters:
baseString- the base stringseparatorPattern- the pattern separating the integer values (if this isnull, the baseString is parsed as one double value)- Returns:
- an array of
doublewhose size is equal to the number values in the input string;nullif this number is equal to zero.
-
-