Package ubic.basecode.util
Class StringUtil
- java.lang.Object
-
- ubic.basecode.util.StringUtil
-
public class StringUtil extends Object
- Author:
- pavlidis
-
-
Constructor Summary
Constructors Constructor Description StringUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Stringappend(String appendee, String appendant, String separator)static StringcommonPrefix(Collection<String> strings)Given a set of strings, identify any prefix they have in common.static StringcommonSuffix(Collection<String> strings)Given a set of strings, identify any suffix they have in common.static booleancontainsValidCharacter(String s)Checks a string to find "strange" character, used by phenocarta to check evidence descriptionstatic String[]csvSplit(String line)static Stringcvs2tsv(String line)Made by Nicolasstatic booleanisLatinLetter(char c)static StringmakeValidForR(String s)Mimics the make.names method in R (character.c) to make valid variables names; we use this for column headers in some output files.static LongtwoStringHashKey(String stringi, String stringj)
-
-
-
Method Detail
-
append
public static String append(String appendee, String appendant, String separator)
- Parameters:
appendee- The string to be added toappendant- The string to add to the end of the appendeeseparator- The string to put between the joined strings, if necessary.- Returns:
- appendee + separator + separator unless appendee is empty, in which case the appendant is returned.
-
commonPrefix
public static String commonPrefix(Collection<String> strings)
Given a set of strings, identify any prefix they have in common.- Parameters:
strings-- Returns:
- the common prefix, null if there isn't one.
-
commonSuffix
public static String commonSuffix(Collection<String> strings)
Given a set of strings, identify any suffix they have in common.- Parameters:
strings-- Returns:
- the commons suffix, null if there isn't one.
-
containsValidCharacter
public static boolean containsValidCharacter(String s)
Checks a string to find "strange" character, used by phenocarta to check evidence description- Parameters:
the- string to check- Returns:
- return false if something strange was found
-
cvs2tsv
public static String cvs2tsv(String line)
Made by Nicolas- Parameters:
a- line in a file cvs format- Returns:
- the same line but in tsv format
-
isLatinLetter
public static boolean isLatinLetter(char c)
-
makeValidForR
public static String makeValidForR(String s)
Mimics the make.names method in R (character.c) to make valid variables names; we use this for column headers in some output files. This doesn't give the exact sames results as R; we avoid repeated '.'.- Parameters:
s-- Returns:
- modified string
-
-