18
18
public class StringFormatter implements IFormattingStyles {
19
public StringFormatter() {
20
format = IFormattingStyles.UNFORMATED;
24
public int getFormat() {
29
public void setFormat(int format) {
34
* Potentially modifies a string value according to a certain format based on the current value
37
* @param s The string to potential modify.
39
* @return The modified string.
42
public String format(String s) {
47
return DateFormat.getDateTimeInstance().format(new Date(Long.parseLong(s)));
49
return "0x"+Long.toHexString(Long.parseLong(s)); //$NON-NLS-1$
51
return "0x"+Long.toOctalString(Long.parseLong(s)); //$NON-NLS-1$
53
return "0x" + Long.toBinaryString(Long.parseLong(s)); //$NON-NLS-1$
55
return "" + Double.parseDouble(s); //$NON-NLS-1$
19
public StringFormatter() {
20
format = IFormattingStyles.UNFORMATED;
24
public int getFormat() {
29
public void setFormat(int format) {
34
* Potentially modifies a string value according to a certain format based on the current value
37
* @param s The string to potential modify.
39
* @return The modified string.
42
public String format(String s) {
47
return DateFormat.getDateTimeInstance().format(new Date(Long.parseLong(s)));
49
return "0x"+Long.toHexString(Long.parseLong(s)); //$NON-NLS-1$
51
return "0x"+Long.toOctalString(Long.parseLong(s)); //$NON-NLS-1$
53
return "0x" + Long.toBinaryString(Long.parseLong(s)); //$NON-NLS-1$
55
return "" + Double.parseDouble(s); //$NON-NLS-1$