liquibase.util
Class StringUtils

java.lang.Object
  extended by liquibase.util.StringUtils

public class StringUtils
extends Object

Various utility methods for working with strings.


Constructor Summary
StringUtils()
           
 
Method Summary
static String join(Collection<String> collection, String delimiter)
           
static String join(int[] array, String delimiter)
           
static String join(Integer[] array, String delimiter)
           
static String join(String[] array, String delimiter)
           
static String[] processMutliLineSQL(String multiLineSQL, boolean stripComments, boolean splitStatements, String endDelimiter)
          Removes any comments from multiple line SQL using stripComments(String) and then extracts each individual statement using splitSQL(String, String).
static String repeat(String string, int times)
           
static List<String> splitAndTrim(String s, String regex)
           
static String[] splitSQL(String multiLineSQL, String endDelimiter)
          Splits a (possible) multi-line SQL statement along ;'s and "go"'s.
static String stripComments(String multiLineSQL)
          Searches through a String which contains SQL code and strips out any comments that are between \/**\/ or anything that matches SP--SP\n (to support the ANSI standard commenting of -- at the end of a line).
static String trimToEmpty(String string)
           
static String trimToNull(String string)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringUtils

public StringUtils()
Method Detail

trimToEmpty

public static String trimToEmpty(String string)

trimToNull

public static String trimToNull(String string)

processMutliLineSQL

public static String[] processMutliLineSQL(String multiLineSQL,
                                           boolean stripComments,
                                           boolean splitStatements,
                                           String endDelimiter)
Removes any comments from multiple line SQL using stripComments(String) and then extracts each individual statement using splitSQL(String, String).

Parameters:
multiLineSQL - A String containing all the SQL statements
stripComments - If true then comments will be stripped, if false then they will be left in the code

splitSQL

public static String[] splitSQL(String multiLineSQL,
                                String endDelimiter)
Splits a (possible) multi-line SQL statement along ;'s and "go"'s.


stripComments

public static String stripComments(String multiLineSQL)
Searches through a String which contains SQL code and strips out any comments that are between \/**\/ or anything that matches SP--SP\n (to support the ANSI standard commenting of -- at the end of a line).

Returns:
The String without the comments in

join

public static String join(String[] array,
                          String delimiter)

join

public static String join(Collection<String> collection,
                          String delimiter)

splitAndTrim

public static List<String> splitAndTrim(String s,
                                        String regex)

repeat

public static String repeat(String string,
                            int times)

join

public static String join(Integer[] array,
                          String delimiter)

join

public static String join(int[] array,
                          String delimiter)


Copyright © 2012 Liquibase.org. All Rights Reserved.