sk.uniba.euromath.tools
Class StringTools

java.lang.Object
  extended by sk.uniba.euromath.tools.StringTools

public class StringTools
extends Object

Contains various string tools.

Author:
Martin Vysny

Method Summary
static String format(String msg, Object... params)
          Processes the message and replaces every %[number] with correspoding Object.toString() from array params with index [number].
static String nonNullStr(String str)
          Deprecated. use StringUtils.defaultString(str) instead.
static String nullStr(String str)
          Deprecated. use StringUtils.defaultIfEmpty(str, null) instead.
static int resolveIndex(String source, int sourceIndex, String result)
          Tries to resolve the index from given string to the result string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

nonNullStr

@Deprecated
public static String nonNullStr(String str)
Deprecated. use StringUtils.defaultString(str) instead.

Converts null string to empty string.

Parameters:
str - string to convert.
Returns:
empty string if str was null, or str itself.

nullStr

@Deprecated
public static String nullStr(String str)
Deprecated. use StringUtils.defaultIfEmpty(str, null) instead.

Converts empty-string to null.

Parameters:
str - string to convert.
Returns:
null if given string was empty string or null, str itself otherwise.

format

public static String format(String msg,
                            Object... params)
Processes the message and replaces every %[number] with correspoding Object.toString() from array params with index [number]. 0 is first Object, 1 second etc. Currently only numbers 0-9 are supported.

Parameters:
msg - message to process
params - parameters for message
Returns:
formatted message

resolveIndex

public static int resolveIndex(String source,
                               int sourceIndex,
                               String result)
Tries to resolve the index from given string to the result string. This method expects that strings differ only by whitespaces.

Parameters:
source - the result of the transformation
sourceIndex - index into the sourceResult string.
result - the result string.
Returns:
index into the result string.


Copyright © 2003-2006 null. All Rights Reserved.