/* End: trim() 
capitalize - capitalize words delimited by a space
@param s - the string to capitalize
@param positions - one or more word positions to capitalize.
@return a capitalized string
969700
function (s, positions) {
		var i, p, words = s.split(" ");

		if (positions === undefined) {
			positions = [];
			for (i = 0; i < words.length; i += 1) {
				positions.push(i);
			}
		} else if (typeof positions === 'number') {
			p = positions;
			positions = [];
			positions.push(p);
		}
		
		for (p = 0; p < positions.length; p += 1) {
			i = positions[p];
			if (words[i] !== undefined) {
				words[i] = words[i].substr(0, 1).toUpperCase() +
					words[i].substr(1);
			}
		}
		return words.join(" ");
	}
519894
public static String titleize(final String text, final String[] intCaps)
    {
        String str = text.toLowerCase(Locale.ENGLISH).replaceAll("[\\s_]+", SPACE).trim();
        return titleize(str, SPACE, intCaps);
    }
391617
public String capitalize( String words ) {
        if (words == null) return null;
        String result = words.trim();
        if (result.length() == 0) return "";
        if (result.length() == 1) return result.toUpperCase();
        return "" + Character.toUpperCase(result.charAt(0)) + result.substring(1).toLowerCase();
    }
1188159
function capitalize(value) {
  var result = []
  var index = -1
  var length = value.length

  while (++index < length) {
    result[index] = value[index].charAt(0).toUpperCase() + value[index].slice(1)
  }

  return result
}
1288048
public static String 
    trimRight( String string, int pos ) 
    {
    	int i = string.length();
    	for( ; i > pos; --i )
    	{
    		char charAt = string.charAt( i - 1 );
            if( charAt != ' ' 
    		 && charAt != '\t'
    		 && charAt != '\n'
    		 && charAt != '\r' ) 
    		{			
    			break;
    		}
    	}
    	
    	if( i <= pos ) 
    	{
    		return "";
    	}
    	
    	return ( 0 == pos && i == string.length() ) ? string : 
    	                                              string.substring( pos, i );
    }
34534
public static int skipSpaces(String s, int start) {

        int limit = s.length();
        int i     = start;

        for (; i < limit; i++) {
            if (s.charAt(i) != ' ') {
                break;
            }
        }

        return i;
    }
382152
func Capitalize(s string) string {
	if len(s) == 1 {
		return strings.ToUpper(s)
	}
	return strings.ToUpper(s[0:1]) + s[1:]
}
1071050
public static String capitalize (String s)
    {
        if (isBlank(s)) {
            return s;
        }
        char c = s.charAt(0);
        if (Character.isUpperCase(c)) {
            return s;
        } else {
            return String.valueOf(Character.toUpperCase(c)) + s.substring(1);
        }
    }
745613
public static String capitalize(String str) {
        char[] array = str.toCharArray();
        if (array.length > 0) {
            array[0] = Character.toUpperCase(array[0]);
        }
        return new String(array);
    }
1199552
def capitalize(string):
    
    if not string:
        return string
    if len(string) == 1:
        return string.upper()
    return string[0].upper() + string[1:].lower()
82504
public Splitter trim(char[] chars) {
    Matcher matcher = new CharsMatcher(chars);
    return new Splitter(pairSeparator, keyValueSeparator, matcher, matcher);
  }
1003055
public static String capitalise(String text) {
        if (empty(text)) {
            return "";
        }
        return text.substring(0, 1).toUpperCase() + text.substring(1);
    }
1078225
public static String 
    trim( String string, int pos ) 
    {
        int len = string.length();

     	int leftPos = pos;
     	int rightPos = len;
     	
    	for( ; rightPos > 0; --rightPos ) 
    	{
    	    char ch = string.charAt( rightPos - 1 );
    		if( ch != ' '
    		    && ch != '\t' 
    		    && ch != '\n' 
    		    && ch != '\r' ) 
    		{    			
    			break;
    		}
    	}
    	
    	for( ; leftPos < rightPos; ++leftPos )
    	{
    	    char ch = string.charAt( leftPos ); 
    		if( ch != ' ' 
    		    && ch != '\t' 
    		    && ch != '\n' 
    		    && ch != '\r' ) 
    		{    			
    			break;
    		}
    	}
    	
    	if( rightPos <= leftPos ) 
    	{
    		return "";
    	}
    	
    	return ( leftPos == 0 && rightPos == string.length() )? string : 
    	                                                        string.substring( leftPos, rightPos );
    }
76881
public String capitalize(String string) {
		if (string == null || string.length() < 1) {
			return "";
		}
		return string.substring(0, 1).toUpperCase() + string.substring(1);
	}
743699
@Nonnull
    public static String[] tokenize(@Nonnull String s, @CheckForNull String delimiter) {
        return QuotedStringTokenizer.tokenize(s,delimiter);
    }
1360809
public static String camelize(final String text, final boolean capitalizeFirstChar)
    {
        StringBuilder sb = new StringBuilder();
        String[] tokens = text.split("[\\.\\s_-]+");

        if (tokens.length < 2)
            return capitalizeFirstChar ? capitalize(text) : text;

        for (String token : tokens)
            sb.append(capitalize(token));

        return capitalizeFirstChar ? sb.toString() : sb.substring(0, 1).toLowerCase(currentLocale())
                + sb.substring(1);
    }
1367489
public static String capitalize( String text )
    {
        if (text == null || text.length() == 0)
            return text;
        
        if (Character.isLowerCase(text.charAt(0)))
            return Character.toUpperCase(text.charAt(0)) + text.substring(1);
        else
            return text;
    }