Protomatter Classes v1.1.6

com.protomatter.util
Class StringUtil

java.lang.Object
  |
  +--com.protomatter.util.StringUtil

public class StringUtil
extends java.lang.Object

Utility methods for manipulating strings.


Method Summary
static void pad(java.lang.StringBuffer b, java.lang.String s, int n)
          Makes sure that a string has no more than n characters, and pads it with spaces if it does.
static java.lang.String pad(java.lang.String s, int n)
          Makes sure that a string has no more than n characters, and pads it with spaces if it does.
static java.lang.String truncate(java.lang.String s, int n)
          Truncate a string to the given length.
static java.lang.String truncateNicely(java.lang.String s, int n)
          Nicely truncate a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

pad

public static void pad(java.lang.StringBuffer b,
                       java.lang.String s,
                       int n)
Makes sure that a string has no more than n characters, and pads it with spaces if it does.

pad

public static java.lang.String pad(java.lang.String s,
                                   int n)
Makes sure that a string has no more than n characters, and pads it with spaces if it does.

truncate

public static java.lang.String truncate(java.lang.String s,
                                        int n)
Truncate a string to the given length. If s.length() <= n, returns s. Else, returns the first n characters of s.

truncateNicely

public static java.lang.String truncateNicely(java.lang.String s,
                                              int n)
Nicely truncate a string. Truncates s to n chars breaking s on whitespace, and adding a "..." to the end.

Protomatter Classes v1.1.6
Copyright 1998-2001 Nate Sammons

Protomatter Classes v1.1.6 http://protomatter.sourceforge.net/1.1.6