com.pkrete.jsip2.util
Class StringUtil

java.lang.Object
  extended by com.pkrete.jsip2.util.StringUtil

public class StringUtil
extends Object

This class offers methods that are needed for handling strings.

Author:
Petteri Kivimäki

Constructor Summary
StringUtil()
           
 
Method Summary
static String bool2Char(boolean value)
          Converts the given boolean to character. false = N, true = Y.
static String bool2CharEmpty(boolean value)
          Converts the given boolean to character. false = ' ', true = 'Y'.
static String bool2Int(boolean value)
          Converts the given boolean to string. false = 0, true = 1.
static String intToFixedLengthString(int value, int length)
          Converts the given integer to a fixed length string by adding leading zeros to the given number that its length equals to the given length.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringUtil

public StringUtil()
Method Detail

bool2Int

public static String bool2Int(boolean value)
Converts the given boolean to string. false = 0, true = 1.

Parameters:
value - boolean value
Returns:
false = 0, true = 1

bool2Char

public static String bool2Char(boolean value)
Converts the given boolean to character. false = N, true = Y.

Parameters:
value - boolean value
Returns:
false = N, true = Y

bool2CharEmpty

public static String bool2CharEmpty(boolean value)
Converts the given boolean to character. false = ' ', true = 'Y'.

Parameters:
value - boolean value
Returns:
false = ' ', true = 'Y'

intToFixedLengthString

public static String intToFixedLengthString(int value,
                                            int length)
Converts the given integer to a fixed length string by adding leading zeros to the given number that its length equals to the given length.

Parameters:
value - integer value to be converted
length - length of the output string
Returns:
string presentation of the given integer


Copyright © 2012-2014. All Rights Reserved.