com.vaadin.sass.internal.util
Class StringUtil

java.lang.Object
  extended by com.vaadin.sass.internal.util.StringUtil

public class StringUtil
extends Object


Constructor Summary
StringUtil()
           
 
Method Summary
static String cleanPath(String path)
           
static String collectionToDelimitedString(Collection coll, String delim)
           
static String collectionToDelimitedString(Collection coll, String delim, String prefix, String suffix)
           
static boolean containsSubString(String text, String sub)
          Check if a String contains a sub string, using whole word match.
static boolean containsVariable(String text, String varName)
          Check if a String contains a SCSS variable, using whole word match.
static String[] delimitedListToStringArray(String str, String delimiter)
           
static String removeDuplicatedSubString(String motherString, String splitter)
          Remove duplicated sub string in a String given a splitter.
static String replace(String inString, String oldPattern, String newPattern)
           
static String replaceSubString(String text, String sub, String value)
          Replace the sub string in a String to a value, using whole word match.
static String replaceVariable(String text, String varName, String value)
          Replace the SCSS variable in a String to its corresponding value, using whole word match.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringUtil

public StringUtil()
Method Detail

cleanPath

public static String cleanPath(String path)

replace

public static String replace(String inString,
                             String oldPattern,
                             String newPattern)

delimitedListToStringArray

public static String[] delimitedListToStringArray(String str,
                                                  String delimiter)

collectionToDelimitedString

public static String collectionToDelimitedString(Collection coll,
                                                 String delim,
                                                 String prefix,
                                                 String suffix)

collectionToDelimitedString

public static String collectionToDelimitedString(Collection coll,
                                                 String delim)

containsVariable

public static boolean containsVariable(String text,
                                       String varName)
Check if a String contains a SCSS variable, using whole word match.

Parameters:
text - text to be checked
Returns:
true if the text contains the SCSS variable, false if not

replaceVariable

public static String replaceVariable(String text,
                                     String varName,
                                     String value)
Replace the SCSS variable in a String to its corresponding value, using whole word match.

Parameters:
text - text which contains the SCSS variable
varName - SCSS variable name (Without '$' sign)
value - the value of the SCSS variable
Returns:
the String after replacing

containsSubString

public static boolean containsSubString(String text,
                                        String sub)
Check if a String contains a sub string, using whole word match.

Parameters:
text - text to be checked
Returns:
true if the text contains the sub string, false if not

replaceSubString

public static String replaceSubString(String text,
                                      String sub,
                                      String value)
Replace the sub string in a String to a value, using whole word match.

Parameters:
text - text which contains the sub string
sub - the sub string
value - the new value
Returns:
the String after replacing

removeDuplicatedSubString

public static String removeDuplicatedSubString(String motherString,
                                               String splitter)
Remove duplicated sub string in a String given a splitter. Can be used to removed duplicated selectors, e.g., in ".error.error", one duplicated ".error" can be removed.

Parameters:
motherString - string which may contains duplicated sub strings
splitter - the splitter splits the mother string to sub strings
Returns:
the mother string with duplicated sub strings removed


Copyright © 2013–2014 Vaadin. All rights reserved.