FileDocCategorySizeDatePackage
StringUtils.javaAPI DocGlassfish v2 API4257Fri May 04 22:35:54 BST 2007com.sun.enterprise.tools.common.util

StringUtils

public class StringUtils extends Object
author
bnevins
version
1.0

Fields Summary
Constructors Summary
Methods Summary
public static java.lang.StringUpperCaseFirstLetter(java.lang.String s)

		if(s == null || s.length() <= 0)
			return s;
		
		return s.substring(0, 1).toUpperCase() + s.substring(1);
	
public static booleanisEmpty(java.lang.String s)

            if((s != null) && (! s.trim().equals(""))) // NOI18N
            {
                return false;
            }else
            {
                return true;
            }
        
public static voidmain(java.lang.String[] args)

		String[] test = new String[] { "xyz", "HITHERE", "123aa", "aSSS", "yothere" };//NOI18N
		
		for(int i = 0; i < test.length; i++)
		{
			System.out.println(test[i] + " >>> " + UpperCaseFirstLetter(test[i]));//NOI18N
		}
	
public static java.lang.StringpadLeft(java.lang.String s, int len)

		if(s == null || s.length() >= len)
			return s;

		String ret = ""; // NOI18N
		
		for(int i = len - s.length(); i > 0; --i)
			ret += ' ";

		return ret + s;
	
public static java.lang.StringpadRight(java.lang.String s, int len)

		if(s == null || s.length() >= len)
			return s;

		for(int i = len - s.length(); i > 0; --i)
			s += ' ";

		return s;
	
public static java.lang.Stringreplace(java.lang.String s, java.lang.String token, java.lang.String replace)

		if(s == null || s.length() <= 0 || token == null || token.length() <= 0)
			return s;
		
		int index = s.indexOf(token);

		if(index < 0)
			return s;

		int tokenLength = token.length();
		String ret = s.substring(0, index);
		ret += replace;
		ret += s.substring(index + tokenLength);

		return ret;
	
public static java.lang.StringtoShortClassName(java.lang.String className)

		int index = className.lastIndexOf('.");

		if(index >= 0 && index < className.length() - 1)
			return className.substring(index + 1);

		return className;