All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class rebelsky.util.StringUtils

java.lang.Object
   |
   +----rebelsky.util.StringUtils

public class StringUtils
extends Object
A collection of simple string utilities. Mostly intended to simplify the formatting of output.

Copyright (c) 1998 Samuel A. Rebelsky. All rights reserved.

Version:
1.0 of February 1998
Author:
Samuel A. Rebelsky

Variable Index

o spaces
A collection of spaces.

Constructor Index

o StringUtils()

Method Index

o center(String, int)
Create a string of the given width with the given string centered and surrounded by spaces.
o left(String, int)
Create a string of the given width with the given string left justified (followed by an appropriate number of spaces).
o right(String, int)
Create a string of the given width with the given string right justified (preceded by an appropriate number of spaces).
o spaces(int)
Get a certain number of spaces.

Variables

o spaces
 public static String spaces
A collection of spaces.

Constructors

o StringUtils
 public StringUtils()

Methods

o center
 public static String center(String str,
                             int width)
Create a string of the given width with the given string centered and surrounded by spaces.
pre: width >= str.length()
post: an appropriate string is returned

Returns:
a string with a centered version of the original string.
o left
 public static String left(String str,
                           int width)
Create a string of the given width with the given string left justified (followed by an appropriate number of spaces).
pre: width >= str.length()
post: an appropriate string is returned

Returns:
a string with a centered version of the original string.
o right
 public static String right(String str,
                            int width)
Create a string of the given width with the given string right justified (preceded by an appropriate number of spaces).
pre: width >= str.length()
post: an appropriate string is returned

Returns:
a string with a centered version of the original string.
o spaces
 public static String spaces(int width)
Get a certain number of spaces.


All Packages  Class Hierarchy  This Package  Previous  Next  Index