edu.mayo.informatics.resourcereader.core
Class StringUtils
java.lang.Object
edu.mayo.informatics.resourcereader.core.StringUtils
public class StringUtils
- extends java.lang.Object
Convenient methods for String manupulation
- Version:
- subversion $Revision: $ checked in on $Date: $
- Author:
- Deepak Sharma
Method Summary |
static java.lang.String |
escapeQuotedComma(java.lang.String str)
This function replaces comma's that are in quoted sentences with a @escapedcomma@ tag. |
static boolean |
isNull(java.lang.String str)
|
static void |
main(java.lang.String[] args)
|
static java.lang.String |
makeStringList(java.util.Collection c)
|
static java.util.Vector<java.lang.String> |
makeWordVectorOfSentence(java.lang.String sentence)
|
static java.lang.String |
parseAsSimpleKeyValue(java.lang.String source,
java.lang.String keyString)
|
static java.lang.String |
removeComments(java.lang.String str)
|
static java.lang.String |
removeOuterMostQuotes(java.lang.String str)
|
static java.lang.String[] |
splitEscapedString(java.lang.String str,
java.lang.String regex)
Split a string taking care not to split the escaped regex sequence For
example, if str= "ab \, cd, efg" and the regex="," then the function
should return ab \,cd and efg. |
static java.lang.String |
unEscapeQuotedComma(java.lang.String str)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StringUtils
public StringUtils()
isNull
public static boolean isNull(java.lang.String str)
makeStringList
public static java.lang.String makeStringList(java.util.Collection c)
makeWordVectorOfSentence
public static java.util.Vector<java.lang.String> makeWordVectorOfSentence(java.lang.String sentence)
- Parameters:
sentence
-
- Returns:
- A Vector of words in the string. Words in double quotes are
treated as a single term. Example
sentence="UK_SPELLING \"British spelling\" EXACT" returns
UK_SPELLING, British spelling, EXACT
parseAsSimpleKeyValue
public static java.lang.String parseAsSimpleKeyValue(java.lang.String source,
java.lang.String keyString)
removeComments
public static java.lang.String removeComments(java.lang.String str)
escapeQuotedComma
public static java.lang.String escapeQuotedComma(java.lang.String str)
- This function replaces comma's that are in quoted sentences with a @escapedcomma@ tag.
For example, the string=abc "Run, Jump and play" gets transformed to
string=abc "Run@escapedcomma@ Jump and play"
- Parameters:
str
-
- Returns:
unEscapeQuotedComma
public static java.lang.String unEscapeQuotedComma(java.lang.String str)
splitEscapedString
public static java.lang.String[] splitEscapedString(java.lang.String str,
java.lang.String regex)
- Split a string taking care not to split the escaped regex sequence For
example, if str= "ab \, cd, efg" and the regex="," then the function
should return ab \,cd and efg. We also need to ensure that we do not split
on commas that are within quotes. For example in
str="neutrophil, stem cell, think" , aa:bb, cc:dd "EFD aaa"
we do not want to split "neutrophil, stem cell, think" apart.
- Parameters:
str
- regex
-
- Returns:
removeOuterMostQuotes
public static java.lang.String removeOuterMostQuotes(java.lang.String str)
main
public static void main(java.lang.String[] args)