|
Project Wonder 5.0 | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecter.extensions.foundation.ERXStringUtilities
public class ERXStringUtilities
Collection of String
utilities. Contains
the base localization support.
Field Summary | |
---|---|
protected static double |
adjustement
holds the base adjustment for fuzzy matching |
static char[] |
HEX_CHARS
Holds the chars for hex encoding |
static com.webobjects.foundation.NSDictionary |
HTML_SAFE_UNESCAPES
Safe HTML entities to unescape (SYMBOL+ISO). |
static com.webobjects.foundation.NSDictionary |
HTML_UNESCAPES
HTML entities to unescape (XML+SYMBOL+ISO). |
static com.webobjects.foundation.NSDictionary |
ISO_UNESCAPES
ISO entities to unescape. |
static com.webobjects.foundation.NSArray |
SORT_ASCENDING
Holds the ascending EOSortOrdering s |
static com.webobjects.foundation.NSArray |
SORT_DESCENDING
Holds the ascending EOSortOrdering s |
static java.lang.String |
SpecialRegexCharacters
Holds characters that have special meaning for regex |
static com.webobjects.foundation.NSDictionary |
SYMBOL_UNESCAPES
Symbol entities to unescape. |
static com.webobjects.foundation.NSDictionary |
XML_UNESCAPES
XML entities to unescape. |
Constructor Summary | |
---|---|
ERXStringUtilities()
|
Method Summary | |
---|---|
static void |
appendSeparatorIfLastNot(char separator,
char not,
java.lang.StringBuffer sb)
Utility method to append a character to a StringBuffer if the last character is not a certain character. |
static java.lang.Object |
attributeCustomValueFromString(com.webobjects.eoaccess.EOAttribute attr,
java.lang.String strVal,
java.lang.String encoding)
Attempts to convert string values for attributes into the appropriate value class for the attribute. |
static java.lang.Number |
attributeNumberValueFromString(com.webobjects.eoaccess.EOAttribute attr,
java.lang.String strVal)
Attempts to convert string values for attributes into the appropriate value class for the attribute. |
static java.lang.Object |
attributeValueFromString(com.webobjects.eoaccess.EOAttribute attr,
java.lang.String strVal,
java.lang.String encoding,
java.text.Format formatter)
Attempts to convert string values for attributes into the appropriate value class for the attribute. |
static java.lang.String |
byteArrayToHexString(byte[] block)
Converts a byte array to hex string. |
static java.lang.String |
camelCaseToUnderscore(java.lang.String camelString,
boolean lowercase)
Converts ThisIsATest to this_is_a_test |
static java.lang.String |
capitalize(java.lang.String value)
Capitalizes a given string. |
static java.lang.String |
capitalizeAllWords(java.lang.String value)
Capitalizes all the strings in a given string. |
static boolean |
caseInsensitiveStartsWith(java.lang.String stringToSearch,
java.lang.String prefix)
Tests if the string starts with the specified prefix ignoring case. |
static boolean |
caseInsensitiveStartsWith(java.lang.String stringToSearch,
java.lang.String prefix,
int toffset)
Tests if the string starts with the specified prefix starting at the specified index ignoring case. |
static boolean |
containsAnyCharacter(java.lang.String source,
java.lang.String characters)
Checks if any of the characters specified in characters is contained in the string specified by source. |
static java.lang.String |
displayNameForKey(java.lang.String key)
Calculates a default display name for a given key path. |
static double |
distance(java.lang.String a,
java.lang.String b)
Java port of the distance algorithm. |
static java.lang.String |
dumpObject(java.lang.Object object)
creates a readable debug string for some data types (dicts, arrays, adaptorOperations, databaseOperations) |
static java.lang.String |
emptyStringForNull(java.lang.String s)
Simple utility method that will return the string "" if the string passed in is null otherwise it will return the passed in string. |
static java.lang.String |
escape(char[] _escapeChars,
char _escapeWith,
java.lang.String _sourceString)
Escapes the given characters with the given escape character in _sourceString. |
static java.lang.String |
escapeJavascriptApostrophes(java.lang.String sourceString)
Escapes the apostrophes in a Javascript string with a backslash. |
static java.lang.String |
escapeNonBasicLatinChars(char c)
|
static java.lang.String |
escapeNonBasicLatinChars(java.lang.String str)
|
static java.lang.String |
escapeNonXMLChars(java.lang.String str)
|
static java.lang.String |
escapePCData(java.lang.String pcdata)
Escapes the given PCDATA string as CDATA. |
static java.lang.String |
escapeSpace(java.lang.String aString)
Removes the spaces in a given String |
static java.lang.String |
excelSafeCsvString(java.lang.String s)
Removes line breaks and quotes the string if neccessary |
static java.lang.String |
firstPropertyKeyInKeyPath(java.lang.String keyPath)
|
static java.lang.String |
fromBytes(byte[] bytes,
java.lang.String encoding)
Utility to convert from bytes without the try/catch. |
static java.lang.String |
fromUTF8Bytes(byte[] bytes)
Utility to convert from UTF-8 bytes without the try/catch. |
static com.webobjects.foundation.NSArray |
fuzzyMatch(java.lang.String name,
java.lang.String entityName,
java.lang.String propertyKey,
java.lang.String synonymsKey,
com.webobjects.eocontrol.EOEditingContext ec,
ERXFuzzyMatchCleaner cleaner,
com.webobjects.foundation.NSArray sortOrderings)
Fuzzy matching is useful for catching user entered typos. |
static com.webobjects.foundation.NSArray |
fuzzyMatch(java.lang.String name,
java.lang.String entityName,
java.lang.String propertyKey,
java.lang.String synonymsKey,
com.webobjects.eocontrol.EOEditingContext ec,
ERXFuzzyMatchCleaner cleaner,
java.lang.String comparisonString)
Deprecated. use fuzzyMatch(String name, String entityName, String propertyKey,
String synonymsKey, EOEditingContext ec,
ERXFuzzyMatchCleaner cleaner, NSArray sortOrderings )
instead |
static java.lang.String |
getSimpleClassName(java.lang.Class clazz)
"Borrowed" from 1.5's Class.getSimpleClassName |
static byte[] |
hexStringToByteArray(java.lang.String hexString)
Converts a even-length, hex-encoded String to a byte array. |
static void |
indent(java.io.PrintWriter writer,
int level)
|
static void |
indent(java.lang.StringBuffer sb,
int level)
|
static int |
indexOfNumericInString(java.lang.String str)
Locate the the first numeric character in the given string. |
static int |
indexOfNumericInString(java.lang.String str,
int fromIndex)
Locate the the first numeric character after fromIndex in the given string. |
static java.lang.String |
insertString(java.lang.String destinationString,
java.lang.String contentToInsert,
int insertOffset)
Inserts the a string into a nother string at a particular offset. |
static java.lang.Integer |
integerWithString(java.lang.String s)
Calculates an Integer for a given string. |
static boolean |
isDigitsOnly(java.lang.String aString)
checks if the specified String contains only digits. |
static boolean |
isLettersOnly(java.lang.String aString)
checks if the specified String contains only Letters. |
static boolean |
isValueInRange(int value,
java.lang.String rangeString)
Returns whether the given value falls in a range defined by the given string, which is in the format "1-5,100,500,800-1000". |
static java.lang.String |
keyPathWithoutFirstProperty(java.lang.String keyPath)
|
static java.lang.String |
keyPathWithoutLastProperty(java.lang.String keyPath)
|
static java.lang.String |
lastPropertyKeyInKeyPath(java.lang.String keyPath)
|
static java.lang.String |
leftPad(java.lang.String string,
char padChar,
int paddedLength)
Pads a string to the specified number of chars by adding the the given pad char on the left side. |
static java.lang.String |
localizedStringForKey(java.lang.String key)
Gets a localized string for a given key in the application's Localizable strings file for the default language (English). |
static java.lang.String |
localizedStringForKey(java.lang.String key,
java.lang.String framework)
Gets a localized string for a given key in a given framework's Localizable strings file for the default language (English). |
static java.lang.String |
localizedStringForKey(java.lang.String key,
java.lang.String framework,
com.webobjects.foundation.NSArray languages)
Gets a localized string for a given key in a given framework's Localizable strings file using the array of languages as the search order for the key. |
static java.lang.String |
localizedTemplateStringWithObjectForKey(java.lang.Object o,
java.lang.String key,
java.lang.String framework,
com.webobjects.foundation.NSArray languages)
Uses the method localizedStringForKey to retreive
a template that is then parsed using the passed in object to
produce a resulting string. |
static java.lang.String |
maskStringWithCharacter(java.lang.String arg,
char mask,
int beginIndex,
int endIndex)
Masks a given string with a single character in the substring specified by the begin and end indexes. |
static java.lang.String |
matchCase(java.lang.String originalString,
java.lang.String newString)
Returns a string case-matched against the original string. |
static byte[] |
md5(java.lang.String str,
java.lang.String encoding)
Generate an MD5 hash from a String. |
static java.lang.String |
md5Hex(java.lang.String str,
java.lang.String encoding)
Generate an MD5 hash as hex from a String. |
static java.lang.String |
nullForEmptyString(java.lang.String s)
Simple utility method that will return null if the string passed in is equal to "" otherwise it will return the passed in string. |
static int |
numberOfOccurrencesOfCharInString(char c,
java.lang.String s)
Counts the number of occurrences of a particular char in a given string. |
static boolean |
quicksilverContains(java.lang.String _str,
java.lang.String _searchString)
Matches strings like Quicksilver (NullPointerException is matched by "NPE"). |
static java.lang.String |
quote(java.lang.String s,
java.lang.String quoteSymbol)
Quote the given string with the provided quote symbols |
static boolean |
regionMatches(java.lang.StringBuffer str,
int toffset,
java.lang.String other,
int ooffset,
int len)
It's ridiculous that StringBuffer doesn't have a .regionMatches like String. |
static java.lang.String |
removeCharacters(java.lang.String source,
java.lang.String characters)
removes any character which is in characters from the source string |
static java.lang.String |
removeExceptCharacters(java.lang.String source,
java.lang.String characters)
removes any character which is not in characters from the source string |
static java.lang.String |
removeExtraDotsFromVersionString(java.lang.String version)
Cleans up the given version string by removing extra dots(.), for example, 5.1.3 becomes 5.13, so that the string can be converted to a double or BigDecimal type easily. |
static java.lang.String |
replaceStringByStringInString(java.lang.String old,
java.lang.String newString,
java.lang.String buffer)
Replaces a given string by another string in a string. |
static java.lang.String |
rightPad(java.lang.String string,
char padChar,
int paddedLength)
Pads a string to the specified number of chars by adding the the given pad char on the right side. |
static java.lang.String |
safeIdentifierName(java.lang.String source)
Convenience method to call safeIdentifierName(source, "_", '_') |
static java.lang.String |
safeIdentifierName(java.lang.String source,
java.lang.String prefix)
Convenience method to call safeIdentifierName(source, prefix, '_') |
static java.lang.String |
safeIdentifierName(java.lang.String source,
java.lang.String prefix,
char replacement)
Converts source to be suitable for use as an identifier in JavaScript. |
static void |
setAdjustement(double newAdjustement)
Sets the base adjustment used for fuzzy matching |
static java.lang.String |
stringByAppendingCSSClass(java.lang.String originalString,
java.lang.String cssClass)
Appends a CSS class to an existing (possibly null) CSS class string. |
static java.lang.String |
stringByReplacingFirstOccurrenceOfStringWithString(java.lang.String sourceString,
java.lang.String stringToReplace,
java.lang.String replacementString)
Replaces the first occurrence of a string with another string in a string. |
static java.lang.String |
stringByTruncatingStringToByteLengthInEncoding(java.lang.String inputString,
int byteLength,
java.lang.String encoding)
This method takes a string and returns a string which is the first string such that the result byte length in the specified encoding does not exceed the byte limit. |
static boolean |
stringContainsSpecialRegexCharacters(java.lang.String s)
checks if the String contains a character that has a special meaning in regex. |
static boolean |
stringEqualsString(java.lang.String s1,
java.lang.String s2)
|
static java.lang.String |
stringFromDictionary(com.webobjects.foundation.NSDictionary dict)
Same as NSPropertySerialization except it sorts on keys first. |
static java.lang.String |
stringFromInputStream(java.io.InputStream in)
Returns a string from the input stream using the default encoding. |
static java.lang.String |
stringFromInputStream(java.io.InputStream in,
java.lang.String encoding)
Returns a string from the input stream using the default encoding. |
static java.lang.String |
stringFromResource(java.lang.String name,
java.lang.String extension,
com.webobjects.foundation.NSBundle bundle)
Retrives a given string for a given name, extension and bundle. |
static java.lang.String |
stringFromURL(java.net.URL url)
Returns a string from the contents of the given URL. |
static java.lang.String |
stringFromURL(java.net.URL url,
java.lang.String encoding)
Returns a string from the contents of the given URL. |
static boolean |
stringIsNullOrEmpty(java.lang.String s)
Simple test if the string is either null or equal to "". |
static java.lang.String |
stringWithContentsOfFile(java.io.File file)
Reads the contents of a file given by a path into a string. |
static java.lang.String |
stringWithContentsOfFile(java.lang.String path)
Reads the contents of a file given by a path into a string. |
static java.lang.String |
stringWithNtimesString(int n,
java.lang.String s)
String multiplication. |
static java.lang.String |
stripHtml(java.lang.String str)
Removes HTML characters from the given string. |
static byte[] |
toBytes(java.lang.String string,
java.lang.String encoding)
Utility to convert to bytes without the try/catch. |
static java.lang.String |
toHexString(char c)
|
static java.lang.String |
toHexString(java.lang.String str)
|
static java.lang.String |
toLowerCase(java.lang.String str)
This method runs about 20 times faster than java.lang.String.toLowerCase (and doesn't waste any storage when the result is equal to the input). |
static java.lang.String |
toString(java.lang.Object[] array,
java.lang.String separator)
Returns a String by invoking toString() on each object from the array. |
static byte[] |
toUTF8Bytes(java.lang.String string)
Utility to convert to UTF-8 bytes without the try/catch. |
static java.lang.String |
trimString(java.lang.String s)
Null-safe wrapper for java.lang.String.trim |
static java.lang.String |
uncapitalize(java.lang.String value)
Uncapitalizes a given string. |
static java.lang.String |
underscoreToCamelCase(java.lang.String underscoreString,
boolean capitalize)
Converts this_is_a_test to ThisIsATest |
static java.lang.String |
unescapeEntities(java.lang.String string,
java.util.Map<java.lang.String,java.lang.String> map)
Util to unescape entities. |
static java.lang.String |
unquote(java.lang.String s,
java.lang.String quoteSymbol)
Remove the quote symbols from the given string |
static java.lang.String |
urlDecode(java.lang.String string)
Utility to decode an URL without the try/catch. |
static java.lang.String |
urlEncode(java.lang.String string)
Utility to encode an URL without the try/catch. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final char[] HEX_CHARS
public static final com.webobjects.foundation.NSArray SORT_ASCENDING
EOSortOrdering
s
public static final com.webobjects.foundation.NSArray SORT_DESCENDING
EOSortOrdering
s
public static final java.lang.String SpecialRegexCharacters
protected static double adjustement
public static final com.webobjects.foundation.NSDictionary XML_UNESCAPES
public static final com.webobjects.foundation.NSDictionary ISO_UNESCAPES
public static final com.webobjects.foundation.NSDictionary SYMBOL_UNESCAPES
public static final com.webobjects.foundation.NSDictionary HTML_SAFE_UNESCAPES
public static final com.webobjects.foundation.NSDictionary HTML_UNESCAPES
Constructor Detail |
---|
public ERXStringUtilities()
Method Detail |
---|
public static double distance(java.lang.String a, java.lang.String b)
a
- first stringb
- second string
public static void setAdjustement(double newAdjustement)
newAdjustement
- factor to be used.public static com.webobjects.foundation.NSArray fuzzyMatch(java.lang.String name, java.lang.String entityName, java.lang.String propertyKey, java.lang.String synonymsKey, com.webobjects.eocontrol.EOEditingContext ec, ERXFuzzyMatchCleaner cleaner, com.webobjects.foundation.NSArray sortOrderings)
name
- to be matched againstentityName
- name of the entity to perform the match against.propertyKey
- to be matched againstsynonymsKey
- allows objects to have additional values to be matched
against in addition to just the value of the propertyKeyec
- context to fetch data incleaner
- object used to clean a string, for example the cleaner might
strip out the words 'The' and 'Inc.'sortOrderings
- can be either SORT_ASCENDING
or SORT_DESCENDING
to tell how the results should be sorted.
public static com.webobjects.foundation.NSArray fuzzyMatch(java.lang.String name, java.lang.String entityName, java.lang.String propertyKey, java.lang.String synonymsKey, com.webobjects.eocontrol.EOEditingContext ec, ERXFuzzyMatchCleaner cleaner, java.lang.String comparisonString)
fuzzyMatch(String name, String entityName, String propertyKey,
String synonymsKey, EOEditingContext ec,
ERXFuzzyMatchCleaner cleaner, NSArray sortOrderings )
instead
public static java.lang.String localizedStringForKey(java.lang.String key)
key
- to be lookup in the strings file
public static java.lang.String localizedStringForKey(java.lang.String key, java.lang.String framework)
key
- to be lookup in the strings fileframework
- name, specify app or null to perform the
lookup in the application's resources.
public static java.lang.String localizedStringForKey(java.lang.String key, java.lang.String framework, com.webobjects.foundation.NSArray languages)
key
- to be lookup in the strings fileframework
- name, specify app or null to perform the
lookup in the application's resources.languages
- array to search for the key in
public static java.lang.String localizedTemplateStringWithObjectForKey(java.lang.Object o, java.lang.String key, java.lang.String framework, com.webobjects.foundation.NSArray languages)
localizedStringForKey
to retreive
a template that is then parsed using the passed in object to
produce a resulting string. The template parser used is
ERXSimpleTemplateParser
.
o
- object used to resolve keys in the localized templatekey
- to be lookup in the strings fileframework
- name, specify app or null to perform the
lookup in the application's resources.languages
- array to search for the key in
public static java.lang.String stringWithContentsOfFile(java.io.File file)
file
- path to the file in the file system
public static java.lang.String stringWithContentsOfFile(java.lang.String path)
path
- to the file in the file system
public static java.lang.Integer integerWithString(java.lang.String s)
s
- string to caclulate an Integer from
ERXConstant#integerForString(String)
public static java.lang.String stringFromResource(java.lang.String name, java.lang.String extension, com.webobjects.foundation.NSBundle bundle)
name
- of the resourceextension
- of the resource, example: txt or rtfbundle
- to look for the resource in
public static final java.lang.String firstPropertyKeyInKeyPath(java.lang.String keyPath)
public static final java.lang.String lastPropertyKeyInKeyPath(java.lang.String keyPath)
public static final java.lang.String keyPathWithoutLastProperty(java.lang.String keyPath)
public static final java.lang.String keyPathWithoutFirstProperty(java.lang.String keyPath)
public static java.lang.String displayNameForKey(java.lang.String key)
key
- to calculate the display name
public static int indexOfNumericInString(java.lang.String str)
str
- string to scan
public static int indexOfNumericInString(java.lang.String str, int fromIndex)
fromIndex
in the given string.
str
- string to scan
public static void appendSeparatorIfLastNot(char separator, char not, java.lang.StringBuffer sb)
separator
- character to add to potentially
add to the StringBuffer.not
- character to test if the given
StringBuffer ends in it.sb
- StringBuffer to test and potentially
append to.public static java.lang.String replaceStringByStringInString(java.lang.String old, java.lang.String newString, java.lang.String buffer)
old
- string to be replacednewString
- to be insertedbuffer
- string to have the replacement done on it
public static java.lang.String stringByReplacingFirstOccurrenceOfStringWithString(java.lang.String sourceString, java.lang.String stringToReplace, java.lang.String replacementString)
sourceString
- string to use on which to perform the replacementstringToReplace
- string to replace in sourceString if it exists.replacementString
- the string with which to replace stringToReplace.
public static java.lang.String escapeSpace(java.lang.String aString)
public static java.lang.String toLowerCase(java.lang.String str)
public static java.lang.String stringWithNtimesString(int n, java.lang.String s)
n
- the number of times to concatinate a given strings
- string to be multipled
public static int numberOfOccurrencesOfCharInString(char c, java.lang.String s)
char
in a given string.
c
- char to count in strings
- string to look for specified char in.
public static boolean stringIsNullOrEmpty(java.lang.String s)
s
- string to test
public static java.lang.String nullForEmptyString(java.lang.String s)
s
- string to test
public static java.lang.String emptyStringForNull(java.lang.String s)
s
- string to test
public static java.lang.String escapeNonXMLChars(java.lang.String str)
public static java.lang.String unescapeEntities(java.lang.String string, java.util.Map<java.lang.String,java.lang.String> map)
string
- string to unescapemap
- map of entities
public static java.lang.String escapePCData(java.lang.String pcdata)
pcdata
- The string to escape
public static java.lang.String escapeNonBasicLatinChars(char c)
public static java.lang.String escapeNonBasicLatinChars(java.lang.String str)
public static java.lang.String escapeJavascriptApostrophes(java.lang.String sourceString)
sourceString
- the source string to escape
public static java.lang.String escape(char[] _escapeChars, char _escapeWith, java.lang.String _sourceString)
_escapeChars
- the list of characters to escape_escapeWith
- the escape character to use_sourceString
- the string to escape the characters in.
public static java.lang.String toHexString(char c)
public static java.lang.String toHexString(java.lang.String str)
public static java.lang.String byteArrayToHexString(byte[] block)
block
- byte array
public static byte[] hexStringToByteArray(java.lang.String hexString)
hexString
- public static java.lang.String removeExtraDotsFromVersionString(java.lang.String version)
version
- string
public static java.lang.String capitalize(java.lang.String value)
value
- to be capitalized
public static java.lang.String uncapitalize(java.lang.String value)
value
- to be uncapitalized
public static java.lang.String capitalizeAllWords(java.lang.String value)
value
- to be capitalized
public static java.lang.String underscoreToCamelCase(java.lang.String underscoreString, boolean capitalize)
underscoreString
- the string_with_underscorescapitalize
- if true, the first letter is capitalized
public static java.lang.String camelCaseToUnderscore(java.lang.String camelString, boolean lowercase)
camelString
- the StringWithCaps
public static boolean stringEqualsString(java.lang.String s1, java.lang.String s2)
public static boolean caseInsensitiveStartsWith(java.lang.String stringToSearch, java.lang.String prefix)
stringToSearch
- string to checkprefix
- prefix to look for
public static boolean caseInsensitiveStartsWith(java.lang.String stringToSearch, java.lang.String prefix, int toffset)
stringToSearch
- string to checkprefix
- prefix to look fortoffset
- starting offset to perform the search
public static java.lang.String stringByTruncatingStringToByteLengthInEncoding(java.lang.String inputString, int byteLength, java.lang.String encoding)
This method is optimized for the UTF-8 case. If encoding
is either "UTF-8" or "UTF8",
the optimized case will kick in.
inputString
- string to truncatebyteLength
- maximum byte lengthencoding
- encoding to use
public static boolean isDigitsOnly(java.lang.String aString)
aString
- the string to check
public static boolean isLettersOnly(java.lang.String aString)
aString
- the string to check
public static boolean stringContainsSpecialRegexCharacters(java.lang.String s)
s
- the string to check
true
if s contains one or multiple characters that have special
meanings in regex.public static java.lang.String stringFromURL(java.net.URL url) throws java.io.IOException
url
- the URL to read from
java.io.IOException
- if the connection failspublic static java.lang.String stringFromURL(java.net.URL url, java.lang.String encoding) throws java.io.IOException
url
- the URL to read fromencoding
- the string encoding to read with
java.io.IOException
- if the connection failspublic static java.lang.String stringFromInputStream(java.io.InputStream in) throws java.io.IOException
in
- stream to read
java.io.IOException
public static java.lang.String stringFromInputStream(java.io.InputStream in, java.lang.String encoding) throws java.io.IOException
in
- stream to readencoding
- to be used, null will use the default
java.io.IOException
public static java.lang.String toString(java.lang.Object[] array, java.lang.String separator)
array
- an object array from which to get a nice String representationseparator
- a separator which is displayed between the objects toString() value
public static java.lang.String dumpObject(java.lang.Object object)
public static boolean containsAnyCharacter(java.lang.String source, java.lang.String characters)
source
- the String which might contain characterscharacters
- the characters to check
public static java.lang.String removeExceptCharacters(java.lang.String source, java.lang.String characters)
source
- the string which will be modifiedcharacters
- the characters that are allowed to be in source
public static java.lang.String removeCharacters(java.lang.String source, java.lang.String characters)
source
- the string which will be modifiedcharacters
- the characters that are not allowed to be in source
public static boolean quicksilverContains(java.lang.String _str, java.lang.String _searchString)
_str
- the string to search in_searchString
- the search string to look for
public static byte[] md5(java.lang.String str, java.lang.String encoding)
str
- the string to hashencoding
- MD5 operates on byte arrays, so we need to know the encoding to getBytes as
java.io.IOException
public static java.lang.String md5Hex(java.lang.String str, java.lang.String encoding)
str
- the string to hashencoding
- MD5 operates on byte arrays, so we need to know the encoding to getBytes as
java.io.IOException
public static java.lang.String matchCase(java.lang.String originalString, java.lang.String newString)
originalString
- the original string to analyze the case ofnewString
- the new string
public static void indent(java.io.PrintWriter writer, int level)
public static void indent(java.lang.StringBuffer sb, int level)
public static java.lang.String getSimpleClassName(java.lang.Class clazz)
public static java.lang.String stringFromDictionary(com.webobjects.foundation.NSDictionary dict)
dict
- public static boolean regionMatches(java.lang.StringBuffer str, int toffset, java.lang.String other, int ooffset, int len)
str
- the StringBuffer to compare a region oftoffset
- the starting offset of the sub-region in this string.other
- the string argument.ooffset
- the starting offset of the sub-region in the string argument.len
- the number of characters to compare.
true
if the specified sub-region of this string
exactly matches the specified sub-region of the string argument;
false
otherwise.public static java.lang.String safeIdentifierName(java.lang.String source, java.lang.String prefix, char replacement)
source
- String to make into a identifier nameprefix
- String to prefix source with to make it a valid identifier namereplacement
- character to use to replace characters in source that are no allowed in an identifier name
Character.isJavaIdentifierStart(char)
,
Character.isJavaIdentifierPart(char)
public static java.lang.String safeIdentifierName(java.lang.String source, java.lang.String prefix)
source
- String to make into a identifier nameprefix
- String to prefix source with to make it a valid identifier name
safeIdentifierName(String, String, char)
public static java.lang.String safeIdentifierName(java.lang.String source)
source
- String to make into a identifier name
safeIdentifierName(String, String, char)
public static java.lang.String urlEncode(java.lang.String string)
string
- public static java.lang.String urlDecode(java.lang.String string)
string
- public static byte[] toUTF8Bytes(java.lang.String string)
string
- string to convertpublic static byte[] toBytes(java.lang.String string, java.lang.String encoding)
string
- string to convertencoding
- public static java.lang.String fromUTF8Bytes(byte[] bytes)
bytes
- string to convertpublic static java.lang.String fromBytes(byte[] bytes, java.lang.String encoding)
bytes
- string to convertencoding
- public static java.lang.String rightPad(java.lang.String string, char padChar, int paddedLength)
string
- the string to padpadChar
- the character to pad withpaddedLength
- the length to pad to
public static java.lang.String leftPad(java.lang.String string, char padChar, int paddedLength)
string
- the string to padpadChar
- the character to pad withpaddedLength
- the length to pad to
public static java.lang.String insertString(java.lang.String destinationString, java.lang.String contentToInsert, int insertOffset)
destinationString
- the string to insert intocontentToInsert
- the string to insertinsertOffset
- the offset in destinationString to insert
public static java.lang.String trimString(java.lang.String s)
s
- string to trim
public static java.lang.String excelSafeCsvString(java.lang.String s)
s
-
public static java.lang.String unquote(java.lang.String s, java.lang.String quoteSymbol)
s
- quoteSymbol
-
public static java.lang.String quote(java.lang.String s, java.lang.String quoteSymbol)
s
- the string to quotequoteSymbol
- - the quote symbol
public static java.lang.String stringByAppendingCSSClass(java.lang.String originalString, java.lang.String cssClass)
originalString
- the original stringcssClass
- the new CSS class to append
public static java.lang.String stripHtml(java.lang.String str)
str
- the string to remove HTML from
public static java.lang.Object attributeValueFromString(com.webobjects.eoaccess.EOAttribute attr, java.lang.String strVal, java.lang.String encoding, java.text.Format formatter)
attr
- The attribute for the value in question.strVal
- The string value to be coerced.encoding
- The encoding used if the attribute value class is custom
and the factory method does not accept a string.formatter
- The formatter used if the value class is NSTimestamp.
public static java.lang.Number attributeNumberValueFromString(com.webobjects.eoaccess.EOAttribute attr, java.lang.String strVal)
attr
- The attribute for the value in question.strVal
- The string value to be coerced.
public static java.lang.Object attributeCustomValueFromString(com.webobjects.eoaccess.EOAttribute attr, java.lang.String strVal, java.lang.String encoding)
attr
- The attribute for the value in question.strVal
- The string value to be coerced.encoding
- The encoding used if the attribute value class is custom
and the factory method does not accept a string.
public static boolean isValueInRange(int value, java.lang.String rangeString)
value
- the value to check forrangeString
- the range string to parse
public static java.lang.String maskStringWithCharacter(java.lang.String arg, char mask, int beginIndex, int endIndex)
maskStringWithCharacter("Visa 4111111111111111", '*', 5, -4);
will
result in a string value of "Visa ************1111"
arg
- The string value to maskmask
- The character maskbeginIndex
- The string index where masking begins.
Negative numbers count down from the end of the string.endIndex
- The index where masking ends.
Negative numbers count down from the end of the string
|
Last updated: Tue, Feb 21, 2017 05:45 PM CET | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |