org.codehaus.mojo.pomtools.helpers
Class LocalStringUtils

java.lang.Object
  extended by org.codehaus.mojo.pomtools.helpers.LocalStringUtils

public final class LocalStringUtils
extends java.lang.Object

Simple utility functions for String

Version:
$Id: LocalStringUtils.java 2166 2006-07-18 21:32:16Z carlos $
Author:
David Hawkins

Method Summary
static java.lang.String ifTrue(boolean condition, java.lang.String trueString, java.lang.String falseString)
          If the condition is true, the trueString is returned, otherwise the falseString is returned.
static java.lang.String makeEndWith(java.lang.String s, java.lang.String strToAppend)
          Appends a string (suffix) to another string if the string does not already end with the suffix.
static java.lang.String splitCamelCase(java.lang.String s)
          Takes a camelCased string and splits it at each capital letter by adding a space.
static java.lang.String[] splitPreserveAllTokens(java.lang.String str, java.lang.String separatorChars)
          Wrapper function for StringUtils.splitPreserveAllTokens(java.lang.String, java.lang.String) so that this plugin doesn't depend on commons-lang directly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

makeEndWith

public static java.lang.String makeEndWith(java.lang.String s,
                                           java.lang.String strToAppend)
Appends a string (suffix) to another string if the string does not already end with the suffix.

If s is null, that value will be returned without the suffix.

Parameters:
s - the string to be appended
strToAppend - the string to append if s doesn't aleady end with suffix.
Returns:
null if s is null, else suffix appended to s

splitCamelCase

public static java.lang.String splitCamelCase(java.lang.String s)
Takes a camelCased string and splits it at each capital letter by adding a space. It also capializes the first letter of each word following whitespace so that the first word capitalization matches the others

For example:
"fooBarFoo" => "Foo Bar Foo" "fooBar foo" => "Foo Bar Foo" null => null "" => "" " " => " "

Parameters:
s -
Returns:

splitPreserveAllTokens

public static java.lang.String[] splitPreserveAllTokens(java.lang.String str,
                                                        java.lang.String separatorChars)
Wrapper function for StringUtils.splitPreserveAllTokens(java.lang.String, java.lang.String) so that this plugin doesn't depend on commons-lang directly.


ifTrue

public static java.lang.String ifTrue(boolean condition,
                                      java.lang.String trueString,
                                      java.lang.String falseString)
If the condition is true, the trueString is returned, otherwise the falseString is returned.

Parameters:
condition - boolean condition to evaluate
trueString - String to return if the condition is true
falseString - String to return if the condition is false


Copyright © 2010 The Codehaus. All Rights Reserved.