org.codehaus.mojo.pomtools.helpers
Class LocalStringUtils

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

public final class LocalStringUtils
extends Object

Simple utility functions for String

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

Method Summary
static String ifTrue(boolean condition, String trueString, String falseString)
          If the condition is true, the trueString is returned, otherwise the falseString is returned.
static String makeEndWith(String s, String strToAppend)
          Appends a string (suffix) to another string if the string does not already end with the suffix.
static String splitCamelCase(String s)
          Takes a camelCased string and splits it at each capital letter by adding a space.
static String[] splitPreserveAllTokens(String str, 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 String makeEndWith(String s,
                                 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 String splitCamelCase(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 String[] splitPreserveAllTokens(String str,
                                              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 String ifTrue(boolean condition,
                            String trueString,
                            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 © 2011 The Codehaus. All Rights Reserved.