| java.lang.Object snow.utils.StringUtils
StringUtils | final public class StringUtils (Code) | | |
Method Summary | |
public static String | balancedRemoveAll(String text, String open, String end) | public static String | balancedRemoveFirst(String text, String open, String end) | public static int | count(String txt, String item) | public static int | count(String txt, char ci) | public static int | countWords(String txt) | public static String | extractFromFirstToLast_Excluded(String line, String from, String to) null if one of from or end not found. | public static String | extractFromFirstToNext_Excluded(String line, String from, String to) null if one of from or end not found. | public static String | extractFromStartUpToFirstExcluded(String text, String upto) | public static String | firstLine(String text) First line only. | public static String | formatTime(long millis) | public static int | getColumnNumberForPosition(String txt, int pos) the column number (first = 1) at the given position in text. | public static int | getLineNumberForPosition(String txt, int pos) | public static int | getPositionFor(String cont, int line, int col) | public static String | getText(String cont, int line, int col, int lineEnd, int colEnd) More robust than simple call based on index position. | public static String | indent(String txt, String ind, boolean exceptFirstLine) Prepend ind to all lines of txt. | public static int | indexOfEndTagIgnoreCase(String text, String tagName) | public static int | indexOfIgnoreCases_SLOW(String src, String toSearch) | public static int | indexOfStartTagIgnoreCase(String text, String tagName) | public static String | keepAfterLastExcl(String text, String from) null if not found. | public static void | main(String[] a) | public static String | removeAfterLastIncluded(String line, String elt) | public static String | removeBeforeIncluded(String line, String elt) | public static String | removeCharsAtEnd(String s, int n) | public static String | removeFirstLine(String mess) | public static String | removeLineTailSpaces(String buf) remove the \r, and the spaces at the end of the lines. | public static String | removeQuotes(String txt, char quote) | public static String | replace(String cont, int line, int col, int lineEnd, int colEnd, String with) More robust than simple replace based on index position. | public static String | shortFormForDisplay(String str, int maxLen) | public static boolean | startsWithIgnoresCaseAndBlanks(String text, String start) |
balancedRemoveFirst | public static String balancedRemoveFirst(String text, String open, String end)(Code) | | For example removing "< * >" items as appearing in a generics type variable declaration
<1<2<3> 4> 5> 6> 789
|
extractFromFirstToLast_Excluded | public static String extractFromFirstToLast_Excluded(String line, String from, String to)(Code) | | null if one of from or end not found.
|
extractFromFirstToNext_Excluded | public static String extractFromFirstToNext_Excluded(String line, String from, String to)(Code) | | null if one of from or end not found.
|
extractFromStartUpToFirstExcluded | public static String extractFromStartUpToFirstExcluded(String text, String upto)(Code) | | null if not found
|
formatTime | public static String formatTime(long millis)(Code) | | |
getColumnNumberForPosition | public static int getColumnNumberForPosition(String txt, int pos)(Code) | | the column number (first = 1) at the given position in text. -1 if bad pos.that is the number of chars backward to the next return.the return itself is considered to be at the end of the line.used because line, col is a robust way to describe a position,absolute positions are not robust.a javax.swing.text.Document will not point to the same char ! |
getLineNumberForPosition | public static int getLineNumberForPosition(String txt, int pos)(Code) | | the line number, 0 for the first, -1 if not found |
getPositionFor | public static int getPositionFor(String cont, int line, int col)(Code) | | -1 if not found
|
getText | public static String getText(String cont, int line, int col, int lineEnd, int colEnd)(Code) | | More robust than simple call based on index position.
|
indent | public static String indent(String txt, String ind, boolean exceptFirstLine)(Code) | | Prepend ind to all lines of txt.
|
indexOfEndTagIgnoreCase | public static int indexOfEndTagIgnoreCase(String text, String tagName)(Code) | | Finds the index of tagName>
the position of > |
indexOfIgnoreCases_SLOW | public static int indexOfIgnoreCases_SLOW(String src, String toSearch)(Code) | | TODO: boost (copy java.lang.String's method)
|
indexOfStartTagIgnoreCase | public static int indexOfStartTagIgnoreCase(String text, String tagName)(Code) | | Finds the index of <tagName
the position of the first letter of the tag, not < |
keepAfterLastExcl | public static String keepAfterLastExcl(String text, String from)(Code) | | null if not found. Exclude the from from returned string.
|
removeBeforeIncluded | public static String removeBeforeIncluded(String line, String elt)(Code) | | the line, where the text before elt has been removed.whole line if elt not found.elt is also removed. |
removeLineTailSpaces | public static String removeLineTailSpaces(String buf)(Code) | | remove the \r, and the spaces at the end of the lines.
(tail or tailing)
|
replace | public static String replace(String cont, int line, int col, int lineEnd, int colEnd, String with)(Code) | | More robust than simple replace based on index position.
|
shortFormForDisplay | public static String shortFormForDisplay(String str, int maxLen)(Code) | | Long strings are replaced with "start...end"
Parameters: maxLen - should be approx 70 |
startsWithIgnoresCaseAndBlanks | public static boolean startsWithIgnoresCaseAndBlanks(String text, String start)(Code) | | Used for example to detect html files (starting with <html> )
ignores the blanks at the text start
|
|
|