public class CMStrings
extends java.lang.Object
Modifier and Type | Class | Description |
---|---|---|
static class |
CMStrings.Diff |
Class representing one diff operation.
|
static class |
CMStrings.DiffOperation |
The data structure representing a diff is a Linked list of Diff objects:
{Diff(Operation.DELETE, "Hello"), Diff(Operation.INSERT, "Goodbye"),
Diff(Operation.EQUAL, " world.")}
which means: delete "Hello", add "Goodbye" and keep " world."
|
Modifier and Type | Field | Description |
---|---|---|
static java.lang.String[] |
emptyStringArray |
A string array with 0 entries
|
static java.lang.String |
SPACES |
1024 spaces
|
Modifier and Type | Method | Description |
---|---|---|
static java.lang.String |
addCommaSpacing(java.lang.String str) |
Finds any commas in the string and ensures there is at least one space
immediately after them.
|
static java.lang.String |
bytesToStr(byte[] b) |
Converts the given byte array back into a string using the current
threads CHARSETINPUT string encoding from the system properties.
|
static java.lang.String |
bytesToStr(java.lang.Object b) |
Converts the given object to a string by the following method:
1.
|
static java.lang.String |
capitalizeAllFirstLettersAndLower(java.lang.String name) |
Capitalizes the first letter in every word in the given string, and lowercases any
other letters in each word.
|
static java.lang.String |
capitalizeAndLower(java.lang.String name) |
Capitalizes the first letter in the given string, and forcibly lowercases
the remaining letters in the string.
|
static java.lang.String |
capitalizeFirstLetter(java.lang.String name) |
Capitalizes the first letter in the given string, if one is found.
|
static java.lang.String |
capitalizeFirstLetterAndEndSentence(java.lang.String name) |
Capitalizes the first letter in the given string, if one is found.
|
static java.lang.String |
centerPreserve(java.lang.String thisStr,
int thisMuch) |
Pads the string equally to the left and right with spaces until it is the
length of the given number.
|
static boolean |
compareStringArraysIgnoreCase(java.lang.String[] A1,
java.lang.String[] A2) |
Compares the two string arrays to see if they are the same, but
in a case-insensitive way.
|
static boolean |
contains(char[] anycs,
char c) |
Checks whether the given character array contains the given character.
|
static boolean |
contains(java.lang.String[] strs,
java.lang.String str) |
Returns whether the given string array contains the given string.
|
static boolean |
containsAny(java.lang.String str,
char[] anycs) |
Checks whether the given string contains any of the given characters.
|
static boolean |
containsIgnoreCase(java.lang.String[] strs,
java.lang.String str) |
Returns whether the given string array contains the given string.
|
static boolean |
containsStarterWith(java.lang.String[] strs,
java.lang.String str) |
Returns whether the given string array contains a string that
start is the first part of the given string, such that:
str.startsWith(strs[x])
This check is Case Sensitive!
|
static boolean |
containsStartsWith(java.lang.String[] strs,
java.lang.String str) |
Returns whether the given string array contains a string that
starts with the given string.
|
static boolean |
containsWord(java.lang.String thisStr,
java.lang.String word) |
Returns whether the given string contains the second string, without any following
letter, which is the CMStrings definition of a "word".
|
static boolean |
containsWordIgnoreCase(java.lang.String thisStr,
java.lang.String word) |
Returns whether the given string contains the second string, without any following
letter, which is the CMStrings definition of a "word".
|
static java.lang.String |
convertHtmlEntities(java.lang.String s) |
This method returns the given string with any
&..; entities converted to their original self
|
static java.lang.String |
convertHtmlToText(java.lang.StringBuilder finalData) |
This monstrous method converts an html document into a somewhat-readable text
document for display in, for example, the text portion of an email, or in the
mud command line.
|
static int |
countChars(java.lang.String str,
char c) |
Counts the number of times the given character appears in the given string.
|
static int |
countSubstrings(java.lang.String[] set,
java.lang.String[] things) |
Counts the number of times all of the strings in the second set appear in any
of the strings in the first set.
|
static java.lang.String |
deEscape(java.lang.String str) |
This methods replaces any double-escapes to single escape characters, and any
escaped double-quotes to double-quotes
|
static java.lang.String |
deEscape(java.lang.String str,
char quot) |
This methods replaces any double-escapes to single escape characters, and any
escaped double-chars to double-chars
|
static java.lang.String |
deleteAllofAny(java.lang.String str,
char[] theseChars) |
Rebuilds the given string by deleting any instances of any of the characters
in the given array.
|
static java.lang.String |
deleteAllofChar(java.lang.String str,
char thisChar) |
Rebuilds the given string by deleting any instances of a given character
The search is case-sensitive.
|
static java.lang.String |
deleteCRLFTAB(java.lang.String str) |
Rebuilds the given string by deleting any instances of \r, \n, \t, and multi-spaces
in the given array.
|
static java.lang.String |
determineEOLN(java.lang.CharSequence str) |
Returns the type of end-of-line used by the given charsequence.
|
static java.util.LinkedList<CMStrings.Diff> |
diff_main(java.lang.String text1,
java.lang.String text2) |
Find the differences between two texts.
|
static java.util.LinkedList<CMStrings.Diff> |
diff_main(java.lang.String text1,
java.lang.String text2,
boolean checklines) |
Find the differences between two texts.
|
static void |
dikufyLineEndings(java.lang.StringBuffer str) |
Normalizes line endings in the given stringbuilder by replacing
all linefeeds with linefeed + carriage return.
|
static java.lang.String |
ellipse(java.lang.String thisStr,
int thisMuch) |
Pads the string to the right with three dots if the string is larger than
the given number, or returns it unchanged otherwise.
|
static java.lang.String |
ellipseColored(java.lang.String thisStr,
int thisMuch) |
Pads the string to the right with three dots if the string is larger than
the given number, or returns it unchanged otherwise.
|
static java.lang.String |
emptyString(java.lang.String str) |
Returns the given string, unless it is null, in which
case it returns "".
|
static java.lang.String |
endWithAPeriod(java.lang.String str) |
Puts a period at the end of the last viewable character in this string,
assuming there isn't already punctuation at the end.
|
static java.lang.String |
escape(java.lang.String str) |
This methods replaces any escapes to double-escape characters, and any
double-quotes to escaped double-quotes
|
static boolean |
filenameMatcher(java.lang.String fileName,
java.lang.String fileNameMask) |
Does traditional filename type matching, where ? substitutes for a
single character, and * for a bunch.
|
static int |
finalDigits(java.lang.String s) |
Returns the value of any digits at the end of the given string.
|
static java.lang.String |
fixMudCRLF(java.lang.String thisStr) |
If the given string contains cr or lf, but not both,
then this method will fix the string to use both as
per mud standard.
|
static java.lang.String |
flatten(java.lang.String str) |
Flattens a string by converting all carriage returns and linefeeds into spaces.
|
static java.lang.String |
getEOL(java.lang.String str,
java.lang.String defaultEOL) |
Returns the apparent end of line string used by the given
string.
|
static java.lang.String |
getSayFromMessage(java.lang.String msg) |
Returns the string between the first and last ' characters in the
given string, or null if no such characters were found.
|
static int |
indexOf(char[] anycs,
char c) |
Checks whether the given character array contains the given character and
if so, returns the index in the array of the character
This method is case-sensitive!
|
static int |
indexOfAny(java.lang.String text,
java.lang.String[] any) |
Returns whether the given string contains any of the given strings in the
array, and if so, which one.
|
static int |
indexOfEndOfWord(java.lang.String s,
int startWith) |
Returns the next index in the given string of an end-of-word character,
such as space,.;? or !.
|
static int |
indexOfLastVowel(java.lang.String s) |
Returns the character index of the last vowel in this string
|
static CMStrings |
instance() |
Returns a static instance of this singleton
|
static boolean |
isLowerCase(java.lang.String str) |
Returns true if the given string is in lowercase, meaning it
has no uppercase characters.
|
static boolean |
isUpperCase(java.lang.String str) |
Returns true if the given string is in uppercase, meaning it
has no lowercase characters.
|
static boolean |
isVowel(char c) |
Returns true if the given character is a vowel AEIOU, or false otherwise.
|
static java.lang.String |
lastWordIn(java.lang.String thisStr) |
Returns all characters after the last space in the
given string, or just returns the given string if no spaces
were found.
|
static int |
lengthMinusColors(java.lang.String thisStr) |
Returns the length of the string as if it has neither
ansi nor cm color codes.
|
static java.lang.String |
limit(java.lang.String thisStr,
int thisMuch) |
Truncates the given string if the string is larger than the given number,
or returns it unchanged otherwise.
|
static java.lang.String |
limit(java.lang.String prefixColorStr,
java.lang.String thisStr,
java.lang.String suffixColorStr,
int thisMuch) |
Truncates the given string if the string is larger than the given number,
or returns it unchanged otherwise.
|
static java.lang.String |
limitColors(java.lang.String thisStr,
int thisMuch) |
Truncates the given string if the string is larger than the given number,
or returns it unchanged otherwise.
|
static java.lang.String |
ltrim(java.lang.String str) |
Trims the given string, but only from the front (left side).
|
static java.util.Map<java.lang.Object,java.lang.Integer> |
makeNumericHash(java.lang.Object[] obj) |
Given an array of objects, this method creates a map of those
objects to their ordinal numeric values.
|
static java.util.Map<java.lang.Object,java.lang.Integer> |
makeNumericHash(java.lang.Object[] obj,
int firstInt) |
Given an array of objects, this method creates a map of those
objects to their ordinal numeric values, with a given opener.
|
static boolean[] |
markMarkups(java.lang.String s) |
Returns a boolean array of the chars marking where
colors (ansi and cm), and other markups chars are
located in the string
|
static boolean |
matches(java.lang.String str,
java.lang.String mask,
boolean caseSensitive) |
|
static void |
normalizeLineEndings(java.lang.StringBuffer str) |
Normalizes line endings in the given stringbuilder by replacing
all carriage returns with only linefeeds.
|
static int |
numWords(java.lang.String str) |
Returns the number of identifiable words in the string
|
static java.lang.String |
padCenter(java.lang.String thisStr,
int thisMuch) |
Pads the string equally to the left and right with spaces until it is the
length of the given number.
|
static java.lang.String |
padLeft(java.lang.String thisStr,
int thisMuch) |
Pads the string to the left with spaces until it is the length
of the given number.
|
static java.lang.String |
padLeft(java.lang.String thisStr,
java.lang.String colorPrefix,
int thisMuch) |
Pads the string to the left with spaces until it is the length of the given
number.
|
static java.lang.String |
padLeftPreserve(java.lang.String thisStr,
int thisMuch) |
Pads the string to the left with spaces until it is the length of the given
number.
|
static java.lang.String |
padLeftWith(java.lang.String thisStr,
char c,
int thisMuch) |
Pads the string to the left with the given character until it is the length
of the given number.
|
static java.lang.String |
padRight(java.lang.String thisStr,
int thisMuch) |
Pads the string to the right with spaces until it is the length
of the given number.
|
static java.lang.String |
padRight(java.lang.String thisStr,
java.lang.String colorSuffix,
int thisMuch) |
Pads the string to the right with spaces until it is the length of the given
number.
|
static java.lang.String |
padRight(java.lang.String prefixColorStr,
java.lang.String thisStr,
java.lang.String suffixColorStr,
int thisMuch) |
Pads the string to the right with spaces until it is the length
of the given number.
|
static java.lang.String |
padRightPreserve(java.lang.String thisStr,
int thisMuch) |
Pads the string to the right with spaces until it is the length of the given
number.
|
static java.lang.String |
padRightWith(java.lang.String thisStr,
char c,
int thisMuch) |
Pads the string to the right with the given character until it is the length
of the given number.
|
static boolean |
parseStringExpression(java.lang.String expression,
java.util.Map<java.lang.String,java.lang.Object> variables,
boolean emptyVarsOK) |
Parses a string comparison expression and returns the result of the evaluation.
|
static java.lang.String |
removeAllButLettersAndDigits(java.lang.String s) |
Strips punctuation characters, leaving only letters and
numbers and such.
|
static java.lang.String |
removeColors(java.lang.String s) |
Strips colors, of both the ansi, and cm code variety
|
static java.lang.String |
removePunctuation(java.lang.String s) |
Strips punctuation characters, leaving only letters and
numbers and such.
|
static java.lang.String |
repeat(char chr1,
int times) |
Builds a string consisting entirely of the given character,
the given number of times in a row.
|
static java.lang.String |
repeat(java.lang.String str1,
int times) |
Builds a string consisting entirely of the given String,
the given number of times in a row.
|
static java.lang.String |
repeatWithLimit(char chr1,
int times,
int limit) |
Builds a string consisting entirely of the given character,
the given number of times in a row.
|
static java.lang.StringBuffer |
replaceAll(java.lang.StringBuffer str,
java.lang.String thisStr,
java.lang.String withThisStr) |
Finds all instances of the second parameter string in the first StringBuffer,
replaces them with the third word.
|
static java.lang.String |
replaceAll(java.lang.String str,
java.lang.String thisStr,
java.lang.String withThisStr) |
Finds all instances of the second parameter string in the first string,
replaces them with the third word.
|
static java.lang.String |
replaceAllIgnoreCase(java.lang.String str,
java.lang.String thisStr,
java.lang.String withThisStr) |
Finds all instances of the second parameter string in the first string, ignoring case,
replaces them with the third word.
|
static java.lang.String |
replaceAllofAny(java.lang.String str,
char[] theseChars,
char with) |
Rebuilds the given string by replacing any instances of any of the characters
in the given array with the given character.
|
static java.lang.String |
replaceAllofAny(java.lang.String str,
char[] theseChars,
char[] withThese) |
Rebuilds the given string by replacing any instances of any of the characters
in the given array with the given character.
|
static java.lang.String |
replaceAlls(java.lang.String str,
java.lang.String[][] pairs) |
Builds a new version of the given string by replacing all instances of the first string
in each pair with the second string.
|
static java.lang.String |
replaceFirst(java.lang.String str,
java.lang.String thisStr,
java.lang.String withThisStr) |
Finds the first and only the first instance of the second parameter string in the first string,
and replaces it with the third string.
|
static java.lang.String |
replaceFirstWord(java.lang.String str,
java.lang.String thisStr,
java.lang.String withThisStr) |
Finds the first and only the first instance of the second parameter word in the first string,
and replaces it with the third word.
|
static java.lang.String[] |
replaceInAll(java.lang.String[] strs,
java.lang.String thisStr,
java.lang.String withThisStr) |
Finds all instances of the second parameter string in each of the strings in the array,
replaces them with the third word.
|
static void |
replaceVariables(java.lang.StringBuffer str,
java.lang.String[] values) |
Replaces @x1 type variables inside a stringbuffer with an actual value
Not used in the main expression system, this is a stand alone function
Also uniquely, supports @x numbers above 10.
|
static int |
replaceVariables(java.lang.StringBuffer str,
java.lang.String[] values,
int highDex) |
Replaces @x1 type variables inside a stringbuffer with an actual value
Not used in the main expression system, this is a stand alone function
Also uniquely, supports @x numbers above 10.
|
static java.lang.String |
replaceVariables(java.lang.String str,
java.lang.String[] values) |
Replaces @x1 type variables inside a stringbuffer with an actual value
Not used in the main expression system, this is a stand alone function
Also uniquely, supports @x numbers above 10.
|
static java.lang.String |
replaceWhole(java.lang.String str,
java.lang.String thisStr,
java.lang.String withThisStr) |
Finds all instances of the second parameter string in the first string,
and replaces it with the third String.
|
static java.lang.String |
replaceWord(java.lang.String str,
java.lang.String thisStr,
java.lang.String withThisStr) |
Finds all instances of the second parameter word in the first string,
and replaces it with the third word.
|
static java.lang.String |
rtrim(java.lang.String str) |
Trims the given string, but only from the end (right side).
|
static java.lang.String |
s_lowercase(java.lang.String str) |
Returns the given string in lowercase, or "" if the string
was null.
|
static java.lang.String |
s_uppercase(java.lang.String str) |
Returns the given string in uppercase, or "" if the string
was null.
|
static java.lang.String |
safeLeft(java.lang.String thisStr,
int thisMuch) |
Truncates the given string if the string is larger than the given number,
or returns it unchanged otherwise.
|
static java.lang.String |
sameCase(java.lang.String str,
char c) |
Returns the given string in the same entire case as the character given.
|
static int |
sameLetterCount(java.lang.String word,
java.lang.String str) |
Returns the number of letters in the second word that are
also found in the first word.
|
static java.lang.String |
scrunchWord(java.lang.String s,
int len) |
Attempts to make the given string only as long as the given length
by first removing all spaces, and then removing all vowels, and
finally just truncating it at the end.
|
static java.lang.String[] |
splitByCapitals(java.lang.String str) |
Splits a string into single spaceless word lengths where each
entry starts with a capital letter of the alphabet.
|
static java.util.Map.Entry<java.lang.Character,java.lang.String>[] |
splitMulti(java.lang.String str,
char[] splitters) |
This strange method parses the given string for one of the characters in the given
array.
|
static void |
stripHeadHtmlTags(java.lang.StringBuilder finalData) |
Strips the leading and trailing <HTML>, <HEAD>, and <BODY> tags from
the given StringBuilder.
|
static byte[] |
strToBytes(java.lang.String str) |
Converts the given string to bytes using the current threads CHARSETINPUT
string encoding from the system properties.
|
static java.lang.String |
substituteSayInMessage(java.lang.String affmsg,
java.lang.String msg) |
This method replaces the string between the first and last ' characters in the
first string with the second string.
|
static java.lang.String |
trimCRLF(java.lang.String thisStr) |
If the given string ends or begins with cr or lf,
then this method removes them before returning the string, and
does nothing otherwise.
|
static java.lang.String |
trimQuotes(java.lang.String thisStr) |
If the given string both begins and ends with double-quotes ",
then this method removes them before returning the string, and
does nothing otherwise.
|
static java.lang.String |
truncate(java.lang.String thisStr,
int thisMuch) |
Truncates the given string if the string is larger than the given number,
or returns it unchanged otherwise.
|
public static final java.lang.String[] emptyStringArray
public static final java.lang.String SPACES
public static final CMStrings instance()
public static final java.lang.String repeat(java.lang.String str1, int times)
str1
- the String to repeattimes
- the size of the stringpublic static final java.lang.String rtrim(java.lang.String str)
str
- the string to trimpublic static final java.lang.String ltrim(java.lang.String str)
str
- the string to trimpublic static final java.lang.String[] splitByCapitals(java.lang.String str)
str
- the string to splitpublic static final java.lang.String repeat(char chr1, int times)
chr1
- the character to repeattimes
- the size of the stringpublic static final java.lang.String repeatWithLimit(char chr1, int times, int limit)
chr1
- the character to repeattimes
- the size of the stringlimit
- the maximum number of repeats before xNNpublic static final boolean isUpperCase(java.lang.String str)
str
- the string to checkpublic static final boolean isLowerCase(java.lang.String str)
str
- the string to checkpublic static final java.lang.String s_uppercase(java.lang.String str)
str
- the string, or nullpublic static final java.lang.String s_lowercase(java.lang.String str)
str
- the string, or nullpublic static final int sameLetterCount(java.lang.String word, java.lang.String str)
word
- the word to look instr
- the word the count is based onpublic static final java.lang.String endWithAPeriod(java.lang.String str)
str
- the string to end with a period.public static final java.lang.String bytesToStr(java.lang.Object b)
b
- the object to inspectpublic static final java.lang.String addCommaSpacing(java.lang.String str)
str
- the string to checkpublic static final java.lang.String bytesToStr(byte[] b)
b
- the byte array to decodepublic static final byte[] strToBytes(java.lang.String str)
str
- the string to encodepublic static final boolean isVowel(char c)
c
- the character to look atpublic static final int indexOfEndOfWord(java.lang.String s, int startWith)
s
- the string to look inside ofstartWith
- the starting index for the searchpublic static final int indexOfLastVowel(java.lang.String s)
s
- the string to look inpublic static final java.lang.String scrunchWord(java.lang.String s, int len)
s
- the string to scrunchlen
- the maximum length of the stringpublic static final int indexOfAny(java.lang.String text, java.lang.String[] any)
text
- the text to searchany
- the list of things to search for in the textpublic static final int finalDigits(java.lang.String s)
s
- the string to look for digits at the end ofpublic static final java.util.Map.Entry<java.lang.Character,java.lang.String>[] splitMulti(java.lang.String str, char[] splitters)
str
- the string to parsesplitters
- the delimiters, and also the keys to the map.entrypublic static final boolean containsWordIgnoreCase(java.lang.String thisStr, java.lang.String word)
thisStr
- the string to look inword
- the string/word to look forpublic static final boolean containsWord(java.lang.String thisStr, java.lang.String word)
thisStr
- the string to look inword
- the string/word to look forpublic static final java.lang.String replaceAllofAny(java.lang.String str, char[] theseChars, char with)
str
- the string to rebuild without those characterstheseChars
- the characters to remove from the stringwith
- the character to replace all the array characters with.public static final java.lang.String replaceAllofAny(java.lang.String str, char[] theseChars, char[] withThese)
str
- the string to rebuild without those characterstheseChars
- the characters to remove from the stringwithThese
- the character to replace all the array characters with.public static final java.lang.String deleteAllofAny(java.lang.String str, char[] theseChars)
str
- the string to rebuild without those characterstheseChars
- the characters to remove from the stringpublic static final java.lang.String deleteCRLFTAB(java.lang.String str)
str
- the string to rebuild without those characterspublic static final java.lang.String deleteAllofChar(java.lang.String str, char thisChar)
str
- the string to rebuild without those charactersthisChar
- the character to remove from the stringpublic static final java.lang.String replaceAll(java.lang.String str, java.lang.String thisStr, java.lang.String withThisStr)
str
- the string to look inside ofthisStr
- the string to look for inside the first stringwithThisStr
- the string to replace the second string with, where found.public static final java.lang.String replaceAllIgnoreCase(java.lang.String str, java.lang.String thisStr, java.lang.String withThisStr)
str
- the string to look inside ofthisStr
- the string to look for inside the first stringwithThisStr
- the string to replace the second string with, where found.public static final java.lang.String flatten(java.lang.String str)
str
- the string to flattenpublic static final java.lang.String deEscape(java.lang.String str)
str
- the string to de-escapepublic static final java.lang.String deEscape(java.lang.String str, char quot)
str
- the string to de-escapequot
- the char to de-escapepublic static final java.lang.String escape(java.lang.String str)
str
- the string to escapepublic static final java.lang.StringBuffer replaceAll(java.lang.StringBuffer str, java.lang.String thisStr, java.lang.String withThisStr)
str
- the StringBuffer to look inside ofthisStr
- the string to look for inside the first stringwithThisStr
- the string to replace the second string with, where found.public static final java.lang.String[] replaceInAll(java.lang.String[] strs, java.lang.String thisStr, java.lang.String withThisStr)
strs
- the string array to look inside ofthisStr
- the string to look for inside the array stringswithThisStr
- the string to replace the second string with, where found.public static final java.lang.String replaceAlls(java.lang.String str, java.lang.String[][] pairs)
str
- the string to rebuildpairs
- the string pairs for search/replace dutiespublic static final java.lang.String replaceWord(java.lang.String str, java.lang.String thisStr, java.lang.String withThisStr)
str
- the string to look inside ofthisStr
- the string to look for inside the first stringwithThisStr
- the string to replace the second string with, where found.public static final java.lang.String replaceWhole(java.lang.String str, java.lang.String thisStr, java.lang.String withThisStr)
str
- the string to look inside ofthisStr
- the string to look for inside the first stringwithThisStr
- the string to replace the second string with, where found.public static final java.lang.String replaceFirstWord(java.lang.String str, java.lang.String thisStr, java.lang.String withThisStr)
str
- the string to look inside ofthisStr
- the string to look for inside the first stringwithThisStr
- the string to replace the second string with, if found.public static final java.lang.String replaceFirst(java.lang.String str, java.lang.String thisStr, java.lang.String withThisStr)
str
- the string to look inside ofthisStr
- the string to look for inside the first stringwithThisStr
- the string to replace the second string with, if found.public static final int numWords(java.lang.String str)
str
- the string to count the words inpublic static final java.lang.String capitalizeAndLower(java.lang.String name)
name
- the string to capitalize and lowercasepublic static final java.lang.String capitalizeAllFirstLettersAndLower(java.lang.String name)
name
- the string with words to capitalize and lowercase.public static final java.lang.String capitalizeFirstLetterAndEndSentence(java.lang.String name)
name
- the string to capitalize and punctuationifypublic static final java.lang.String capitalizeFirstLetter(java.lang.String name)
name
- the string to capitalizepublic static final java.lang.String lastWordIn(java.lang.String thisStr)
thisStr
- the string to look for spaces inpublic static final java.lang.String getSayFromMessage(java.lang.String msg)
msg
- the string to parse out frompublic static final java.lang.String substituteSayInMessage(java.lang.String affmsg, java.lang.String msg)
affmsg
- the string to replace a portion ofmsg
- the string to insert into the first string, between the ' charspublic static final boolean containsIgnoreCase(java.lang.String[] strs, java.lang.String str)
strs
- the array to look instr
- the string to look forpublic static final boolean compareStringArraysIgnoreCase(java.lang.String[] A1, java.lang.String[] A2)
A1
- the first string arrayA2
- the second string arraypublic static final boolean contains(java.lang.String[] strs, java.lang.String str)
strs
- the array to look instr
- the string to look forpublic static final boolean contains(char[] anycs, char c)
anycs
- the character array to look inc
- the character to look forpublic static final int indexOf(char[] anycs, char c)
anycs
- the character array to look inc
- the character to look forpublic static final boolean containsAny(java.lang.String str, char[] anycs)
str
- the string to checkanycs
- the list of characters to look forpublic static final boolean containsStartsWith(java.lang.String[] strs, java.lang.String str)
strs
- the array to look instr
- the string to look forpublic static final boolean containsStarterWith(java.lang.String[] strs, java.lang.String str)
strs
- the array to look instr
- the string to look forpublic static final void replaceVariables(java.lang.StringBuffer str, java.lang.String[] values)
str
- the stringbuffer to assessvalues
- values to replace each variable withpublic static final int replaceVariables(java.lang.StringBuffer str, java.lang.String[] values, int highDex)
str
- the stringbuffer to assessvalues
- values to replace each variable withhighDex
- the index to use for @x0public static final java.lang.String replaceVariables(java.lang.String str, java.lang.String[] values)
str
- the stringbuffer to assessvalues
- values to replace each variable withpublic static final java.lang.String removePunctuation(java.lang.String s)
s
- the string to strippublic static final java.lang.String removeAllButLettersAndDigits(java.lang.String s)
s
- the string to strippublic static final java.lang.String removeColors(java.lang.String s)
s
- the string to strippublic static final boolean[] markMarkups(java.lang.String s)
s
- the string to strippublic static final int lengthMinusColors(java.lang.String thisStr)
thisStr
- the string to get the length ofpublic static java.lang.String convertHtmlEntities(java.lang.String s)
s
- the string to convertpublic static java.lang.String convertHtmlToText(java.lang.StringBuilder finalData)
finalData
- the stringbuilder containing the html to convert.public static java.lang.String getEOL(java.lang.String str, java.lang.String defaultEOL)
str
- the string to checkdefaultEOL
- eol string to use if undeterminedpublic static void stripHeadHtmlTags(java.lang.StringBuilder finalData)
finalData
- the StringBuilder to remove leading tags from.public static final java.util.Map<java.lang.Object,java.lang.Integer> makeNumericHash(java.lang.Object[] obj)
obj
- the array of objectspublic static final java.util.Map<java.lang.Object,java.lang.Integer> makeNumericHash(java.lang.Object[] obj, int firstInt)
obj
- the array of objectsfirstInt
- the ordinal value to start withpublic static final java.lang.String padCenter(java.lang.String thisStr, int thisMuch)
thisStr
- the string to padthisMuch
- the final minimum length of the string.public static final java.lang.String padLeft(java.lang.String thisStr, int thisMuch)
thisStr
- the string to pad or truncatethisMuch
- the final minimum length of the string.public static final java.lang.String padLeftWith(java.lang.String thisStr, char c, int thisMuch)
thisStr
- the string to pad or truncatec
- the character to pad the string withthisMuch
- the final minimum length of the string.public static final java.lang.String padLeft(java.lang.String thisStr, java.lang.String colorPrefix, int thisMuch)
thisStr
- the string to pad or truncatecolorPrefix
- the string to always add to the beginning of the given string before spacesthisMuch
- the final minimum length of the string.public static final java.lang.String safeLeft(java.lang.String thisStr, int thisMuch)
thisStr
- the string to pad or truncatethisMuch
- the final maximum length of the string.public static final java.lang.String truncate(java.lang.String thisStr, int thisMuch)
thisStr
- the string to pad or truncatethisMuch
- the final maximum length of the string.public static final java.lang.String trimQuotes(java.lang.String thisStr)
thisStr
- the string to remove quotes frompublic static final java.lang.String trimCRLF(java.lang.String thisStr)
thisStr
- the string to remove cr and lf frompublic static final java.lang.String fixMudCRLF(java.lang.String thisStr)
thisStr
- the string to fix cr and lf inpublic static final java.lang.String padRight(java.lang.String thisStr, int thisMuch)
thisStr
- the string to pad or truncatethisMuch
- the final minimum length of the string.public static final java.lang.String padRight(java.lang.String prefixColorStr, java.lang.String thisStr, java.lang.String suffixColorStr, int thisMuch)
prefixColorStr
- the string to prefix the padded string withthisStr
- the string to pad or truncatesuffixColorStr
- the string to suffix the string before paddingthisMuch
- the final minimum length of the string.public static final java.lang.String padRightWith(java.lang.String thisStr, char c, int thisMuch)
thisStr
- the string to pad or truncatec
- the character to pad the string withthisMuch
- the final minimum length of the string.public static final java.lang.String limit(java.lang.String prefixColorStr, java.lang.String thisStr, java.lang.String suffixColorStr, int thisMuch)
prefixColorStr
- the string to prefix the padded string withthisStr
- the string to pad or truncatesuffixColorStr
- the string to suffix the string before paddingthisMuch
- the final maximum length of the string.public static final java.lang.String limit(java.lang.String thisStr, int thisMuch)
thisStr
- the string to pad or truncatethisMuch
- the final maximum length of the string.public static final java.lang.String limitColors(java.lang.String thisStr, int thisMuch)
thisStr
- the string to pad or truncatethisMuch
- the final maximum length of the string.public static final java.lang.String ellipse(java.lang.String thisStr, int thisMuch)
thisStr
- the string to pad or truncatethisMuch
- the final maximum length of the string before ...public static final java.lang.String emptyString(java.lang.String str)
str
- the stringpublic static final java.lang.String ellipseColored(java.lang.String thisStr, int thisMuch)
thisStr
- the string to pad or truncatethisMuch
- the final maximum length of the string before ...public static final java.lang.String padRight(java.lang.String thisStr, java.lang.String colorSuffix, int thisMuch)
thisStr
- the string to pad or truncatecolorSuffix
- the string to always add to the end of the given string before spacesthisMuch
- the final minimum length of the string.public static final java.lang.String padRightPreserve(java.lang.String thisStr, int thisMuch)
thisStr
- the string to padthisMuch
- the final minimum length of the string.public static final java.lang.String centerPreserve(java.lang.String thisStr, int thisMuch)
thisStr
- the string to padthisMuch
- the final minimum length of the string.public static final java.lang.String padLeftPreserve(java.lang.String thisStr, int thisMuch)
thisStr
- the string to padthisMuch
- the final minimum length of the string.public static final java.lang.String sameCase(java.lang.String str, char c)
str
- the string to make upper or lowercasec
- if this character is uppercase, makes the whole string uppercase, etc.public static void normalizeLineEndings(java.lang.StringBuffer str)
str
- the modified stringpublic static void dikufyLineEndings(java.lang.StringBuffer str)
str
- the modified stringpublic static final boolean parseStringExpression(java.lang.String expression, java.util.Map<java.lang.String,java.lang.Object> variables, boolean emptyVarsOK) throws java.lang.Exception
expression
- the string expression to evaluatevariables
- the map of variable names to String objectsemptyVarsOK
- true if missing variables are "", and false otherwise.java.lang.Exception
- an error occurred in parsingpublic static final int countSubstrings(java.lang.String[] set, java.lang.String[] things)
set
- the set of strings to search throughthings
- the set of strings to search FORpublic static final boolean matches(java.lang.String str, java.lang.String mask, boolean caseSensitive)
public static final int countChars(java.lang.String str, char c)
str
- the string to search throughc
- the character to countpublic static final java.lang.String determineEOLN(java.lang.CharSequence str)
str
- the char sequence to checkpublic static java.util.LinkedList<CMStrings.Diff> diff_main(java.lang.String text1, java.lang.String text2)
text1
- Old string to be diffed.text2
- New string to be diffed.public static java.util.LinkedList<CMStrings.Diff> diff_main(java.lang.String text1, java.lang.String text2, boolean checklines)
text1
- Old string to be diffed.text2
- New string to be diffed.checklines
- Speedup flag. If false, then don't run a
line-level diff first to identify the changed areas.
If true, then run a faster slightly less optimal diff.public static final boolean filenameMatcher(java.lang.String fileName, java.lang.String fileNameMask)
fileName
- the name to check for a matchfileNameMask
- the mask to match the fileName against