de.goerntkai.toolbox.misc
Class StringUtil

java.lang.Object
  extended byde.goerntkai.toolbox.misc.StringUtil

public abstract class StringUtil
extends java.lang.Object

Provides some tasks for dealing with Strings.

Version:
$Id: StringUtil.java,v 1.3 2007/05/01 14:53:42 GoerntKai Exp $
Author:
Kai Görnt

Method Summary
static java.lang.String leadWithCharacter(char theCharacter, java.lang.String theString, int theLength)
          Adds leading characters to a given String.
static java.lang.String leadWithSpaces(java.lang.String theString, int theLength)
          Adds leading spaces to a given String.
static java.lang.String leadWithZeroes(int theString, int theLength)
          Adds leading zeroes to a given integer.
static java.lang.String leadWithZeroes(java.lang.String theString, int theLength)
          Adds leading zeroes to a given String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

leadWithCharacter

public static java.lang.String leadWithCharacter(char theCharacter,
                                                 java.lang.String theString,
                                                 int theLength)

Adds leading characters to a given String. If the string is already longer than the given length it will be cut down to it. If the string is null the returned string will only consist of the given characters.

Parameters:
theCharacter - to enlengthen the string with
theString - to enlengthen
theLength - to enlengthen the string to
Returns:
the string with leading characters up to the given length

leadWithSpaces

public static java.lang.String leadWithSpaces(java.lang.String theString,
                                              int theLength)

Adds leading spaces to a given String. If the string is already longer than the given length it will be cut down to it. If the string is null the returned string will only consist of spaces.

Parameters:
theString - to enlengthen
theLength - to enlengthen the string to
Returns:
the string with leading spaces up to the given length

leadWithZeroes

public static java.lang.String leadWithZeroes(int theString,
                                              int theLength)

Adds leading zeroes to a given integer. If the integer is already longer than the given length it will be cut down to it. If the integer is null the returned string will only consist of zeroes.

Parameters:
theString - to enlengthen
theLength - to enlengthen the string to
Returns:
the string with leading zeroes up to the given length

leadWithZeroes

public static java.lang.String leadWithZeroes(java.lang.String theString,
                                              int theLength)

Adds leading zeroes to a given String. If the string is already longer than the given length it will be cut down to it. If the string is null the returned string will only consist of zeroes.

Parameters:
theString - to enlengthen
theLength - to enlengthen the string to
Returns:
the string with leading zeroes up to the given length


Copyright © 2004-2007 Kai Görnt. All Rights Reserved.