com.taleo.integration.client.customstep.velocity
Class StringTool

java.lang.Object
  extended by com.taleo.integration.client.customstep.velocity.StringTool

public class StringTool
extends java.lang.Object

Class to expose String functions into Velocity templates.

Author:
Romain Guay - Taleo Corporation

Constructor Summary
StringTool()
           
 
Method Summary
 java.lang.String concat(java.lang.Object obj1, java.lang.Object obj2)
          Concatenate two strings.
 boolean contains(java.lang.Object obj1, java.lang.Object obj2)
          Check if the first argument string contains the second argument string.
 boolean endsWith(java.lang.Object obj1, java.lang.Object obj2)
          Check if the first argument string ends with the second argument string.
 java.lang.String leftPad(java.lang.Object obj, int size)
          Left pad a string with spaces.
 java.lang.String leftPad(java.lang.Object obj, int size, java.lang.String padString)
          Left pad a string with the given pad string.
 int length(java.lang.Object obj)
          Get the length of the given string.
 boolean matches(java.lang.Object obj1, java.lang.Object obj2)
          Check if the first argument string matches the regex pattern in the second argument string.
 java.lang.String rightPad(java.lang.Object obj, int size)
          Right pad a string with spaces.
 java.lang.String rightPad(java.lang.Object obj, int size, java.lang.String padString)
          Right pad a string with the given pad string.
 boolean startsWith(java.lang.Object obj1, java.lang.Object obj2)
          Check if the first argument string starts with the second argument string.
 java.lang.String substring(java.lang.Object obj, int beginIndex, int endIndex)
          Gets a substring from the specified String.
 java.lang.String substringAfter(java.lang.Object obj, java.lang.String separator)
          Gets the substring after the first occurrence of a separator.
 java.lang.String substringAfterLast(java.lang.Object obj, java.lang.String separator)
          Gets the substring after the last occurrence of a separator.
 java.lang.String substringBefore(java.lang.Object obj, java.lang.String separator)
          Gets the substring before the first occurrence of a separator.
 java.lang.String substringBeforeLast(java.lang.Object obj, java.lang.String separator)
          Gets the substring before the last occurrence of a separator.
 java.lang.String toLowerCase(java.lang.Object obj)
          Converts all of the characters to lower case.
 java.lang.String toUpperCase(java.lang.Object obj)
          Converts all of the characters to upper case.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringTool

public StringTool()
Method Detail

rightPad

public java.lang.String rightPad(java.lang.Object obj,
                                 int size,
                                 java.lang.String padString)
Right pad a string with the given pad string.

Parameters:
obj - The string or object to be converted to string.
size - The total size after padding.
padString - The pad string.
Returns:
The padded string.

rightPad

public java.lang.String rightPad(java.lang.Object obj,
                                 int size)
Right pad a string with spaces.

Parameters:
obj - The string or object to be converted to string.
size - The total size after padding.
Returns:
The padded string.

leftPad

public java.lang.String leftPad(java.lang.Object obj,
                                int size,
                                java.lang.String padString)
Left pad a string with the given pad string.

Parameters:
obj - The string or object to be converted to string.
size - The total size after padding.
padString - The pad string.
Returns:
The padded string.

leftPad

public java.lang.String leftPad(java.lang.Object obj,
                                int size)
Left pad a string with spaces.

Parameters:
obj - The string or object to be converted to string.
size - The total size after padding.
Returns:
The padded string.

length

public int length(java.lang.Object obj)
Get the length of the given string.

Parameters:
obj - The string or object to be converted to string.
Returns:
The length.

substring

public java.lang.String substring(java.lang.Object obj,
                                  int beginIndex,
                                  int endIndex)
Gets a substring from the specified String.

Parameters:
obj - The string or object to be converted to string.
beginIndex - The begin index.
endIndex - The end index.
Returns:
The substring.

substringAfter

public java.lang.String substringAfter(java.lang.Object obj,
                                       java.lang.String separator)
Gets the substring after the first occurrence of a separator.

Parameters:
obj - The string or object to be converted to string.
separator - The separator string.
Returns:
The substring.

substringAfterLast

public java.lang.String substringAfterLast(java.lang.Object obj,
                                           java.lang.String separator)
Gets the substring after the last occurrence of a separator.

Parameters:
obj - The string or object to be converted to string.
separator - The separator string.
Returns:
The substring.

substringBefore

public java.lang.String substringBefore(java.lang.Object obj,
                                        java.lang.String separator)
Gets the substring before the first occurrence of a separator.

Parameters:
obj - The string or object to be converted to string.
separator - The separator string.
Returns:
The substring.

substringBeforeLast

public java.lang.String substringBeforeLast(java.lang.Object obj,
                                            java.lang.String separator)
Gets the substring before the last occurrence of a separator.

Parameters:
obj - The string or object to be converted to string.
separator - The separator string.
Returns:
The substring.

toUpperCase

public java.lang.String toUpperCase(java.lang.Object obj)
Converts all of the characters to upper case.

Parameters:
obj - The string or object to be converted to string.
Returns:
The string to upper case.

toLowerCase

public java.lang.String toLowerCase(java.lang.Object obj)
Converts all of the characters to lower case.

Parameters:
obj - The string or object to be converted to string.
Returns:
The string to lower case.

concat

public java.lang.String concat(java.lang.Object obj1,
                               java.lang.Object obj2)
Concatenate two strings.

Parameters:
obj1 - The first string or object to be converted to string.
obj2 - The second string or object to be converted to string.
Returns:
The string to lower case.

contains

public boolean contains(java.lang.Object obj1,
                        java.lang.Object obj2)
Check if the first argument string contains the second argument string.

Parameters:
obj1 - The first string or object to be converted to string.
obj2 - The second string or object to be converted to string.
Returns:
true if the first argument string contains the second, false otherwise.

startsWith

public boolean startsWith(java.lang.Object obj1,
                          java.lang.Object obj2)
Check if the first argument string starts with the second argument string.

Parameters:
obj1 - The first string or object to be converted to string.
obj2 - The second string or object to be converted to string.
Returns:
true if the first argument string starts with the second, false otherwise.

endsWith

public boolean endsWith(java.lang.Object obj1,
                        java.lang.Object obj2)
Check if the first argument string ends with the second argument string.

Parameters:
obj1 - The first string or object to be converted to string.
obj2 - The second string or object to be converted to string.
Returns:
true if the first argument string ends with the second, false otherwise.

matches

public boolean matches(java.lang.Object obj1,
                       java.lang.Object obj2)
Check if the first argument string matches the regex pattern in the second argument string.

Parameters:
obj1 - The first string or object to be converted to string.
obj2 - The second string or object to be converted to string.
Returns:
true if the first argument string matches the regex pattern in the second, false otherwise.