org.mockftpserver.core.util
Class StringUtil

java.lang.Object
  extended by org.mockftpserver.core.util.StringUtil

public class StringUtil
extends Object

Contains static String-related utility methods.

Version:
$Revision: 198 $ - $Date: 2008-12-10 21:47:32 -0500 (Wed, 10 Dec 2008) $
Author:
Chris Mair

Method Summary
static String join(Collection parts, String delimiter)
          Join the Strings within the parts Collection, inserting the delimiter in between elements
static String padLeft(String string, int width)
          Pad the specified String with spaces to the left to the specified width.
static String padRight(String string, int width)
          Pad the specified String with spaces to the right to the specified width.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

padRight

public static String padRight(String string,
                              int width)
Pad the specified String with spaces to the right to the specified width. If the length of string is already equal to or greater than width, then just return string.

Parameters:
string - - the String to pad
width - - the target width
Returns:
a String of at least width characters, padded on the right with spaces as necessary

padLeft

public static String padLeft(String string,
                             int width)
Pad the specified String with spaces to the left to the specified width. If the length of string is already equal to or greater than width, then just return string.

Parameters:
string - - the String to pad
width - - the target width
Returns:
a String of at least width characters, padded on the left with spaces as necessary

join

public static String join(Collection parts,
                          String delimiter)
Join the Strings within the parts Collection, inserting the delimiter in between elements

Parameters:
parts - - the Collection of Strings to join
delimiter - - the delimiter String to insert between the parts
Returns:
the Strings within the parts collection joined together using the specified delimiter


Copyright © 2014. All rights reserved.