com.github.ignition.support
Class IgnitedStrings

java.lang.Object
  extended by com.github.ignition.support.IgnitedStrings

public class IgnitedStrings
extends Object


Constructor Summary
IgnitedStrings()
           
 
Method Summary
static String[] splitByCharacterTypeCamelCase(String str)
           Splits a String by Character type as returned by java.lang.Character.getType(char).
static String underscore(String camelCaseString)
          Turns a camel case string into an underscored one, e.g.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IgnitedStrings

public IgnitedStrings()
Method Detail

underscore

public static String underscore(String camelCaseString)
Turns a camel case string into an underscored one, e.g. "HelloWorld" becomes "hello_world".

Parameters:
camelCaseString - the string to underscore
Returns:
the underscored string

splitByCharacterTypeCamelCase

public static String[] splitByCharacterTypeCamelCase(String str)

Splits a String by Character type as returned by java.lang.Character.getType(char). Groups of contiguous characters of the same type are returned as complete tokens, with the following exception: the character of type Character.UPPERCASE_LETTER, if any, immediately preceding a token of type Character.LOWERCASE_LETTER will belong to the following token rather than to the preceding, if any, Character.UPPERCASE_LETTER token.

 StringUtils.splitByCharacterTypeCamelCase(null)         = null
 StringUtils.splitByCharacterTypeCamelCase("")           = []
 StringUtils.splitByCharacterTypeCamelCase("ab de fg")   = ["ab", " ", "de", " ", "fg"]
 StringUtils.splitByCharacterTypeCamelCase("ab   de fg") = ["ab", "   ", "de", " ", "fg"]
 StringUtils.splitByCharacterTypeCamelCase("ab:cd:ef")   = ["ab", ":", "cd", ":", "ef"]
 StringUtils.splitByCharacterTypeCamelCase("number5")    = ["number", "5"]
 StringUtils.splitByCharacterTypeCamelCase("fooBar")     = ["foo", "Bar"]
 StringUtils.splitByCharacterTypeCamelCase("foo200Bar")  = ["foo", "200", "Bar"]
 StringUtils.splitByCharacterTypeCamelCase("ASFRules")   = ["ASF", "Rules"]
 

Parameters:
str - the String to split, may be null
Returns:
an array of parsed Strings, null if null String input
Since:
2.4


Copyright © 2012. All Rights Reserved.