|
.NET Framework | |||||||||
PREV TYPE NEXT TYPE | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONST | PROP | METHOD | OP | EVENT | DETAIL: FIELD | CONST | PROP | METHOD | OP | EVENT |
This class provides some methods for dynamically invoking methods in objects, and some string manipulation methods used by torque. The string methods will soon be moved into the turbine string utilities class. *
Constructor Summary | |
---|---|
StringUtils() Initializes a new instance of the StringUtils class. |
Method Summary | |
---|---|
bool |
allEmpty(System.Collections.IList list) Check to see if all the string objects passed in are empty. * |
string |
capitalizeFirstLetter(string data) Capitalize the first letter but leave the rest as they are. * For example fooBarbecomes FooBar. * |
string |
chop(string s, int i) Chop i characters off the end of a string. This method assumes that any EOL characters in String s and the platform EOL will be the same. A 2 character EOL will count as 1 character. * |
string |
chop(string s, int i, string eol) Chop i characters off the end of a string. A 2 character EOL will count as 1 character. * |
string |
collapseNewlines(string argStr) Remove/collapse multiple newline characters. * |
string |
collapseSpaces(string argStr) Remove/collapse multiple spaces. * |
string |
concat(System.Collections.IList list) Concatenates a list of objects as a String. * |
string |
fileContentsToString(string file) Read the contents of a file and place them in a string object. * |
string |
firstLetterCaps(string data) Makes the first letter caps and the rest lowercase. * For example fooBarbecomes Foobar. * |
string |
getPackageAsPath(string pckge) Return a package name as a relative path name * |
string |
normalizePath(string path) Return a context-relative path, beginning with a "/", that represents the canonical version of the specified path after ".." and "." elements are resolved out. If the specified path attempts to go outside the boundaries of the current context (i.e. too many ".." path elements are present), return nullinstead. * |
string |
removeAndHump(string data) 'Camels Hump' replacement of underscores. * Remove underscores from a string but leave the capitalization of the other letters unchanged. * For example foo_barBarbecomes FooBarBar. * |
string |
removeAndHump(string data, string replaceThis) 'Camels Hump' replacement. * Remove one string from another string but leave the capitalization of the other letters unchanged. * For example, removing "_" from foo_barBarbecomes FooBarBar. * |
string |
removeUnderScores(string data) Remove underscores from a string and replaces first letters with capitals. Other letters are changed to lower case. * For example foo_barbecomes FooBarbut foo_barBarbecomes FooBarbar. * |
string |
select(bool state, string trueString, string falseString) If state is true then return the trueString, else return the falseString. * |
string[] |
split(string line, string delim) Create a string array from a string separated by delim * |
string |
stackTrace(System.Exception e) Returns the output of printStackTrace as a String. * |
System.Text.StringBuilder |
stringSubstitution(string argStr, System.Collections.Hashtable vars) Perform a series of substitutions. The substitions are performed by replacing $variable in the target string with the value of provided by the key "variable" in the provided hashtable. * |
string |
sub(string line, string oldString, string newString) Replaces all instances of oldString with newString in line. Taken from the Jive forum package. * |
Methods inherited from class System.Object |
---|
Equals, Finalize, GetHashCode, GetType, MemberwiseClone, ToString |
Constructor Detail |
---|
public StringUtils()
Initializes a new instance of the StringUtils class.
Method Detail |
---|
public bool allEmpty(System.Collections.IList list)
Check to see if all the string objects passed in are empty. *
Parameters:
list
- A list of {@link java.lang.String} objects.
public string capitalizeFirstLetter(string data)
Capitalize the first letter but leave the rest as they are. * For example
fooBarbecomes
FooBar. *
Parameters:
data
- capitalize this
public string chop(string s, int i)
Chop i characters off the end of a string. This method assumes that any EOL characters in String s and the platform EOL will be the same. A 2 character EOL will count as 1 character. *
Parameters:
string
- String to chop.
i
- Number of characters to chop.
public string chop(string s, int i, string eol)
Chop i characters off the end of a string. A 2 character EOL will count as 1 character. *
Parameters:
string
- String to chop.
i
- Number of characters to chop.
eol
- A String representing the EOL (end of line).
public string collapseNewlines(string argStr)
Remove/collapse multiple newline characters. *
Parameters:
String
- string to collapse newlines in.
public string collapseSpaces(string argStr)
Remove/collapse multiple spaces. *
Parameters:
String
- string to remove multiple spaces from.
public string concat(System.Collections.IList list)
Concatenates a list of objects as a String. *
Parameters:
list
- The list of objects to concatenate.
public string fileContentsToString(string file)
Read the contents of a file and place them in a string object. *
Parameters:
String
- path to file.
public string firstLetterCaps(string data)
Makes the first letter caps and the rest lowercase. * For example
fooBarbecomes
Foobar. *
Parameters:
data
- capitalize this
public string getPackageAsPath(string pckge)
Return a package name as a relative path name *
Parameters:
String
- package name to convert to a directory.
public string normalizePath(string path)
Return a context-relative path, beginning with a "/", that represents the canonical version of the specified path after ".." and "." elements are resolved out. If the specified path attempts to go outside the boundaries of the current context (i.e. too many ".." path elements are present), return
nullinstead. *
Parameters:
path
- Path to be normalized
public string removeAndHump(string data)
'Camels Hump' replacement of underscores. * Remove underscores from a string but leave the capitalization of the other letters unchanged. * For example
foo_barBarbecomes
FooBarBar. *
Parameters:
data
- string to hump
public string removeAndHump(string data, string replaceThis)
'Camels Hump' replacement. * Remove one string from another string but leave the capitalization of the other letters unchanged. * For example, removing "_" from
foo_barBarbecomes
FooBarBar. *
Parameters:
data
- string to hump
replaceThis
- string to be replaced
public string removeUnderScores(string data)
Remove underscores from a string and replaces first letters with capitals. Other letters are changed to lower case. * For example
foo_barbecomes
FooBarbut
foo_barBarbecomes
FooBarbar. *
Parameters:
data
- string to remove underscores from.
public string select(bool state, string trueString, string falseString)
If state is true then return the trueString, else return the falseString. *
Parameters:
boolean
- String
- trueString
String
- falseString
public string[] split(string line, string delim)
Create a string array from a string separated by delim *
Parameters:
line
- the line to split
delim
- the delimter to split by
public string stackTrace(System.Exception e)
Returns the output of printStackTrace as a String. *
Parameters:
e
- A Throwable.
public System.Text.StringBuilder stringSubstitution(string argStr, System.Collections.Hashtable vars)
Perform a series of substitutions. The substitions are performed by replacing $variable in the target string with the value of provided by the key "variable" in the provided hashtable. *
Parameters:
String
- target string
Hashtable
- name/value pairs used for substitution
public string sub(string line, string oldString, string newString)
Replaces all instances of oldString with newString in line. Taken from the Jive forum package. *
Parameters:
String
- original string.
String
- string in line to replace.
String
- replace oldString with this.
|
.NET Framework | |||||||||
PREV TYPE NEXT TYPE | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONST | PROP | METHOD | OP | EVENT | DETAIL: FIELD | CONST | PROP | METHOD | OP | EVENT |