org.thymeleaf.util
Class StringUtils

Object
  extended by org.thymeleaf.util.StringUtils

public final class StringUtils
extends Object

Since:
1.0
Author:
Daniel Fernández, Le Roux Bernard

Method Summary
static String abbreviate(Object target, int maxSize)
           
static String append(Object target, String suffix)
           
static String capitalize(Object target)
           Convert the first letter of target to uppercase (title-case, in fact).
static String capitalizeWords(Object target)
           Convert all the first letter of the words of target to uppercase (title-case, in fact).
static String capitalizeWords(Object target, Object delimiters)
           Convert all the first letter of the words of target to uppercase (title-case, in fact), using the specified delimiter chars for determining word ends/starts.
static Boolean contains(Object target, String fragment)
           
static Boolean containsIgnoreCase(Object target, String fragment, java.util.Locale locale)
           
static Boolean endsWith(Object target, String suffix)
           
static Integer indexOf(Object target, String fragment)
           
static Boolean isEmpty(Object target)
           
static String join(Iterable<?> target, String separator)
           
static String join(Object[] target, String separator)
           
static Integer length(Object target)
           
static String prepend(Object target, String prefix)
           
static String replace(Object target, String before, String after)
           
static String[] split(Object target, String separator)
           
static Boolean startsWith(Object target, String prefix)
           
static String substring(Object target, int beginIndex)
           copy a part of target start beginIndex to the end of target.
static String substring(Object target, int beginIndex, int endIndex)
           
static String substringAfter(Object target, String substr)
           
static String substringBefore(Object target, String substr)
           
static String toLowerCase(Object target, java.util.Locale locale)
           
static String toUpperCase(Object target, java.util.Locale locale)
           
static String trim(Object target)
           
static String unCapitalize(Object target)
           Convert the first letter of target to lowercase.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

abbreviate

public static String abbreviate(Object target,
                                int maxSize)

contains

public static Boolean contains(Object target,
                               String fragment)

containsIgnoreCase

public static Boolean containsIgnoreCase(Object target,
                                         String fragment,
                                         java.util.Locale locale)

startsWith

public static Boolean startsWith(Object target,
                                 String prefix)

endsWith

public static Boolean endsWith(Object target,
                               String suffix)

substring

public static String substring(Object target,
                               int beginIndex,
                               int endIndex)

substring

public static String substring(Object target,
                               int beginIndex)

copy a part of target start beginIndex to the end of target. If non-String object, toString() will be called.

Parameters:
target - source of the copy.
beginIndex - index where the copy start.
Returns:
part of target.
Since:
1.1.2

substringAfter

public static String substringAfter(Object target,
                                    String substr)

substringBefore

public static String substringBefore(Object target,
                                     String substr)

prepend

public static String prepend(Object target,
                             String prefix)

append

public static String append(Object target,
                            String suffix)

indexOf

public static Integer indexOf(Object target,
                              String fragment)

isEmpty

public static Boolean isEmpty(Object target)

join

public static String join(Object[] target,
                          String separator)

join

public static String join(Iterable<?> target,
                          String separator)

split

public static String[] split(Object target,
                             String separator)

length

public static Integer length(Object target)

replace

public static String replace(Object target,
                             String before,
                             String after)

toUpperCase

public static String toUpperCase(Object target,
                                 java.util.Locale locale)

toLowerCase

public static String toLowerCase(Object target,
                                 java.util.Locale locale)

trim

public static String trim(Object target)

capitalize

public static String capitalize(Object target)

Convert the first letter of target to uppercase (title-case, in fact).

Parameters:
target - the String to be capitalized. If non-String object, toString() will be called.
Returns:
String the result of capitalizing the target.
Since:
1.1.2

unCapitalize

public static String unCapitalize(Object target)

Convert the first letter of target to lowercase.

Parameters:
target - the String to be uncapitalized. If non-String object, toString() will be called.
Returns:
String the result of uncapitalizing the target.
Since:
1.1.2

capitalizeWords

public static String capitalizeWords(Object target)

Convert all the first letter of the words of target to uppercase (title-case, in fact). The default delimiter characters between the words are the whitespace characters (see Characters.IsWhiteSpace method in the Java doc).

Parameters:
target - the String to be capitalized. If non-String object, toString() will be called.
Returns:
String the result of capitalizing the target.
Since:
1.1.2

capitalizeWords

public static String capitalizeWords(Object target,
                                     Object delimiters)

Convert all the first letter of the words of target to uppercase (title-case, in fact), using the specified delimiter chars for determining word ends/starts.

Parameters:
target - the String to be capitalized. If non-String object, toString() will be called.
delimiters - delimiters of the words. If non-String object, toString() will be called.
Returns:
String the result of capitalizing the target.
Since:
1.1.2


Copyright © 2012 The THYMELEAF team. All Rights Reserved.