All Packages Class Hierarchy This Package Previous Next Index
Class JObserve.PictureFormat
java.lang.Object
|
+----JObserve.PictureFormat
- public class PictureFormat
- extends Object
Implement PictureFormat from a now dead language (PL/I)
This class consists solely of static functions.
Result character arrays are the same size as the Pattern array and each
character in the pattern controls the corresponding value in the output.
E.g. "1234.56" with pattern "ZZ,ZZ,ZZ.ZZZ" => "00,12,34.560".
Special characters in pattern:
- 'Z' - a digit from the input string; a blank is used if there
are no more digits from the input string.
- '9' - a digit from the input string; a '0' is used if there
are no more digits from the input string.
- 'B' - a blank
- '-' - a digit from the input string; the sign character in the least
signifigant digit for which there is not an input digit.
- '+' - like '-' but + sign is replaced by a blank
- Anything else is written to the output string.
-
PictureFormat()
-
-
PictureFormat(String, String)
- Format a numeric string from a given pattern.
-
StringLeft(String, int)
- Reformat a string in a left justified, blank filled character array.
-
StringRight(String, int)
- Reformat a string in a right justified, blank filled character array.
PictureFormat
public PictureFormat()
PictureFormat
public static char[] PictureFormat(String Digits,
String Pattern)
- Format a numeric string from a given pattern.
Since Java string handling is so weak the string is returned in a
character array.
- Parameters:
-
String
- The digits string (to be reformatted)
-
String
- The pattern, each character defines
the contents of the corresponding position in the output,
- Returns:
-
char[]
The formatted string in a character array.
StringLeft
public static char[] StringLeft(String Digits,
int size)
- Reformat a string in a left justified, blank filled character array.
In the input string is longer than the output string, truncate on the right
- Parameters:
-
String
- The digits string (to be reformatted)
-
int
- The size of the output character array.
- Returns:
-
char[]
The formatted string in a character array.
StringRight
public static char[] StringRight(String Digits,
int size)
- Reformat a string in a right justified, blank filled character array.
In the input string is longer than the output string, truncate on the right
- Parameters:
-
String
- The digits string (to be reformatted)
-
int
- The size of the output character array.
- Returns:
-
char[]
The formatted string in a character array.
All Packages Class Hierarchy This Package Previous Next Index