xbn.string.padchop
Class PadChopString

java.lang.Object
  |
  +--xbn.XBNObject
        |
        +--xbn.string.padchop.PadChopString

public class PadChopString
extends XBNObject

Pad and/or chop a string to a specific length. The configuration for this class is held in a PCSConfig.

Source code:  PadChopString.java.  Example code  XmplPadChopString.


Fields inherited from class xbn.XBNObject
bFALSE_IN_PRODUCTION, bTRUE_IN_PRODUCTION, sCNSTR, sES, sLINE_SEP
 
Constructor Summary
PadChopString(PCSConfig pcs_config)
          Create a PadChopString.
 
Method Summary
 String get(boolean b_oolean)
          Get a copy of the boolean after it is padded/chopped.
 String get(char c_har)
          Get a copy of the char after it is padded/chopped.
 String get(int i_nt)
          Get a copy of the int after it is padded/chopped.
 String get(int i_length, boolean b_oolean)
          Get a copy of the boolean after it is padded/chopped.
 String get(int i_length, char c_har)
          Get a copy of the char after it is padded/chopped.
 String get(int i_length, int i_nt)
          Get a copy of the int after it is padded/chopped.
 String get(int i_length, String s_tr)
          Get a copy of the string after it is padded/chopped.
 String get(String s_tr)
          Get a copy of the string after it is padded/chopped.
 PCSConfig getPCSConfig()
          Get the PCSConfig for direct manipulation.
 void padChop(int i_length, StringBuffer str_buffer)
          Pad/chop the StringBuffer.
 void padChop(int i_length, StringOrBuffer str_orBfr)
          Get the padded/chopped StringBuffer, based upon the configuration held in the PCSConfig.
 void padChop(StringBuffer str_buffer)
          Pad/chop the StringBuffer.
 void padChop(StringOrBuffer str_orBfr)
          Get the padded/chopped StringBuffer, based upon the configuration held in the PCSConfig.
 void setPCSConfig(PCSConfig pcs_config)
          Set the configuration defining how the string should be padded/chopped.
 String toString()
          Get some information about this PadChopString.
 
Methods inherited from class xbn.XBNObject
getXMsgPrefix, sop, sopl, sopl, throwAX, throwAXIfBadStr, throwAXIfNull, throwAXSpoof
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PadChopString

public PadChopString(PCSConfig pcs_config)

Create a PadChopString.

Parameters:
pcs_config - The configuration for this PadChopString. May not be null. See setPCSConfig.
Method Detail

getPCSConfig

public final PCSConfig getPCSConfig()

Get the PCSConfig for direct manipulation.

Returns:
pcs_config exactly as provided to setPCSConfig.

setPCSConfig

public final void setPCSConfig(PCSConfig pcs_config)

Set the configuration defining how the string should be padded/chopped.

Get with getPCSConfig

Parameters:
pcs_config - The configuration for this PadChopString. May not be null.

get

public String get(boolean b_oolean)

Get a copy of the boolean after it is padded/chopped.

Returns:
The contents of getSOBFromS: padChop([UtilString].getSOBS(new Boolean(b_oolean).toString(), "get"))


get

public String get(char c_har)

Get a copy of the char after it is padded/chopped.

Returns:
The contents of getSOBFromS: padChop([UtilString].getSOBS(new Character(c_har).toString(), "get"))


get

public String get(int i_nt)

Get a copy of the int after it is padded/chopped.

Returns:
The contents of getSOBFromS: padChop([UtilString].getSOBS(new Integer(i_nt).toString(), "get"))


get

public String get(String s_tr)

Get a copy of the string after it is padded/chopped.

Returns:
The contents of getSOBFromS: padChop([UtilString].getSOBS(s_tr, "get"))


padChop

public void padChop(StringBuffer str_buffer)

Pad/chop the StringBuffer.

Equal to padChop([UtilStringBuffer].getSOBSB(str_buffer, "get")).getStringBuffer()


padChop

public void padChop(StringOrBuffer str_orBfr)

Get the padded/chopped StringBuffer, based upon the configuration held in the PCSConfig. See getPCSConfig.

Parameters:
str_buffer - The StringBuffer to pad or chop.
Returns:
A StringBuffer padded or chopped, based upon the configuration held in the PCSConfig.

get

public String get(int i_length,
                  boolean b_oolean)

Get a copy of the boolean after it is padded/chopped.

Before returning, this calls

getPCSConfig().setLength(i_length)

If you don't need to reset the length every time, then use only get.

Returns:
get(b_oolean)

get

public String get(int i_length,
                  char c_har)

Get a copy of the char after it is padded/chopped.

Before returning, this calls

getPCSConfig().setLength(i_length)

If you don't need to reset the length every time, then use only get.

Returns:
get(c_har)

get

public String get(int i_length,
                  int i_nt)

Get a copy of the int after it is padded/chopped.

Before returning, this calls

getPCSConfig().setLength(i_length)

If you don't need to reset the length every time, then use only get.

Returns:
get(i_nt)

get

public String get(int i_length,
                  String s_tr)

Get a copy of the string after it is padded/chopped.

Before returning, this calls

getPCSConfig().setLength(i_length)

If you don't need to reset the length every time, then use only get.

Returns:
get(s_tr)

padChop

public void padChop(int i_length,
                    StringBuffer str_buffer)

Pad/chop the StringBuffer.

Before returning, this calls

getPCSConfig().setLength(i_length)

If you don't need to reset the length every time, then use only padChop.

Returns:
padChop(str_buffer)

padChop

public void padChop(int i_length,
                    StringOrBuffer str_orBfr)

Get the padded/chopped StringBuffer, based upon the configuration held in the PCSConfig.

Before returning, this calls

getPCSConfig().setLength(i_length)

If you don't need to reset the length every time, then use only padChop.

Returns:
padChop(str_orBfr)

toString

public final String toString()

Get some information about this PadChopString.

Overrides:
toString in class Object



Copyright 1997-2003, Jeff Epstein, All Rights Reserved. See top of source code files for copyright notice.

 

http://sourceforge.net/projects/xbnjava

 

SourceForge.net Logo