
Static Public Member Functions | |
| static void | appendSeparatorIfLastNot (char separator, char not, StringBuffer sb) |
| static Object | attributeCustomValueFromString (EOAttribute attr, String strVal, String encoding) |
| static Number | attributeNumberValueFromString (EOAttribute attr, String strVal) |
| static Object | attributeValueFromString (EOAttribute attr, String strVal, String encoding, Format formatter) |
| static String | byteArrayToHexString (byte[] block) |
| static String | camelCaseToUnderscore (String camelString, boolean lowercase) |
| static String | capitalize (String value) |
| static String | capitalizeAllWords (String value) |
| static boolean | caseInsensitiveStartsWith (String stringToSearch, String prefix, int toffset) |
| static boolean | caseInsensitiveStartsWith (String stringToSearch, String prefix) |
| static boolean | containsAnyCharacter (String source, String characters) |
| static String | displayNameForKey (String key) |
| static double | distance (String a, String b) |
| static String | dumpObject (Object object) |
| static String | emptyStringForNull (String s) |
| static String | escape (char[] _escapeChars, char _escapeWith, String _sourceString) |
| static String | escapeJavascriptApostrophes (String sourceString) |
| static String | escapeNonBasicLatinChars (String str) |
| static String | escapeNonBasicLatinChars (char c) |
| static String | escapeNonXMLChars (String str) |
| static String | escapePCData (String pcdata) |
| static String | escapeSpace (String aString) |
| static String | excelSafeCsvString (String s) |
| static final String | firstPropertyKeyInKeyPath (String keyPath) |
| static String | fromBytes (byte bytes[], String encoding) |
| static String | fromUTF8Bytes (byte bytes[]) |
| static NSArray | fuzzyMatch (String name, String entityName, String propertyKey, String synonymsKey, EOEditingContext ec, ERXFuzzyMatchCleaner cleaner, String comparisonString) |
| static NSArray | fuzzyMatch (String name, String entityName, String propertyKey, String synonymsKey, EOEditingContext ec, ERXFuzzyMatchCleaner cleaner, NSArray sortOrderings) |
| static String | getSimpleClassName (Class clazz) |
| static byte[] | hexStringToByteArray (String hexString) |
| static void | indent (StringBuffer sb, int level) |
| static void | indent (PrintWriter writer, int level) |
| static int | indexOfNumericInString (String str, int fromIndex) |
| static int | indexOfNumericInString (String str) |
| static String | insertString (String destinationString, String contentToInsert, int insertOffset) |
| static Integer | integerWithString (String s) |
| static boolean | isDigitsOnly (String aString) |
| static boolean | isLettersOnly (String aString) |
| static boolean | isValueInRange (int value, String rangeString) |
| static final String | keyPathWithoutFirstProperty (String keyPath) |
| static final String | keyPathWithoutLastProperty (String keyPath) |
| static final String | lastPropertyKeyInKeyPath (String keyPath) |
| static String | leftPad (String string, char padChar, int paddedLength) |
| static String | localizedStringForKey (String key, String framework, NSArray languages) |
| static String | localizedStringForKey (String key, String framework) |
| static String | localizedStringForKey (String key) |
| static String | localizedTemplateStringWithObjectForKey (Object o, String key, String framework, NSArray languages) |
| static String | maskStringWithCharacter (String arg, char mask, int beginIndex, int endIndex) |
| static String | matchCase (String originalString, String newString) |
| static byte[] | md5 (String str, String encoding) |
| static String | md5Hex (String str, String encoding) |
| static String | nullForEmptyString (String s) |
| static int | numberOfOccurrencesOfCharInString (char c, String s) |
| static boolean | quicksilverContains (String _str, String _searchString) |
| static String | quote (String s, String quoteSymbol) |
| static boolean | regionMatches (StringBuffer str, int toffset, String other, int ooffset, int len) |
| static String | removeCharacters (String source, String characters) |
| static String | removeExceptCharacters (String source, String characters) |
| static String | removeExtraDotsFromVersionString (String version) |
| static String | replaceStringByStringInString (String old, String newString, String buffer) |
| static String | rightPad (String string, char padChar, int paddedLength) |
| static String | safeIdentifierName (String source) |
| static String | safeIdentifierName (String source, String prefix) |
| static String | safeIdentifierName (String source, String prefix, char replacement) |
| static void | setAdjustement (double newAdjustement) |
| static String | stringByAppendingCSSClass (String originalString, String cssClass) |
| static String | stringByReplacingFirstOccurrenceOfStringWithString (final String sourceString, final String stringToReplace, final String replacementString) |
| static String | stringByTruncatingStringToByteLengthInEncoding (final String inputString, final int byteLength, final String encoding) |
| static boolean | stringContainsSpecialRegexCharacters (String s) |
| static boolean | stringEqualsString (String s1, String s2) |
| static String | stringFromDictionary (NSDictionary dict) |
| static String | stringFromInputStream (InputStream in, String encoding) throws IOException |
| static String | stringFromInputStream (InputStream in) throws IOException |
| static String | stringFromResource (String name, String extension, NSBundle bundle) |
| static String | stringFromURL (URL url, String encoding) throws IOException |
| static String | stringFromURL (URL url) throws IOException |
| static boolean | stringIsNullOrEmpty (String s) |
| static String | stringWithContentsOfFile (String path) |
| static String | stringWithContentsOfFile (File file) |
| static String | stringWithNtimesString (int n, String s) |
| static String | stripHtml (String str) |
| static byte[] | toBytes (String string, String encoding) |
| static String | toHexString (String str) |
| static String | toHexString (char c) |
| static String | toLowerCase (String str) |
| static String | toString (Object[] array, String separator) |
| static byte[] | toUTF8Bytes (String string) |
| static String | trimString (String s) |
| static String | uncapitalize (String value) |
| static String | underscoreToCamelCase (String underscoreString, boolean capitalize) |
| static String | unescapeEntities (String string, Map< String, String > map) |
| static String | unquote (String s, String quoteSymbol) |
| static String | urlDecode (String string) |
| static String | urlEncode (String string) |
Static Public Attributes | |
| static final char[] | HEX_CHARS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' } |
| static final NSDictionary | HTML_SAFE_UNESCAPES |
| static final NSDictionary | HTML_UNESCAPES |
| static final NSDictionary | ISO_UNESCAPES |
| static final NSArray | SORT_ASCENDING |
| static final NSArray | SORT_DESCENDING |
| static final String | SpecialRegexCharacters = ".*[]{}()?\\+%$!^" |
| static final NSDictionary | SYMBOL_UNESCAPES |
| static final NSDictionary | XML_UNESCAPES |
Static Protected Attributes | |
| static double | adjustement = 0.5 |
Static Package Functions | |
| [static initializer] | |
Static Private Member Functions | |
| static NSDictionary | adaptorOperationAsDictionary (EOAdaptorOperation op) |
| static NSDictionary | databaseOperationAsDictionary (EODatabaseOperation op) |
| static void | dumpArray (StringBuffer sb, NSArray array, int level) |
| static void | dumpDictionary (StringBuffer sb, NSDictionary dict, int level) |
| static void | dumpObject (StringBuffer sb, Object value, int level) |
| static String | getSimpleBinaryName (Class clazz) |
| static boolean | isAsciiDigit (char c) |
Static Private Attributes | |
| static NSArray | _defaultTargetDisplayLanguages = new NSArray(DEFAULT_TARGET_DISPLAY_LANGUAGE) |
| static final String | _DISTANCE = "distance" |
| static final String | DEFAULT_TARGET_DISPLAY_LANGUAGE = "English" |
| static Logger | log = Logger.getLogger(ERXStringUtilities.class) |
| [static initializer] | ( | ) | [static, package] |
| static NSDictionary adaptorOperationAsDictionary | ( | EOAdaptorOperation | op | ) | [static, private] |
Debug method to get the EOAdaptorOperation as a dictionary that can be pretty-printed later. The output from a EOGeneralAdaptorException.userInfo.toString is pretty much unreadable.
| op |
| static void appendSeparatorIfLastNot | ( | char | separator, | |
| char | not, | |||
| StringBuffer | sb | |||
| ) | [static] |
Utility method to append a character to a StringBuffer if the last character is not a certain character. Useful for determining if you need to add an '&' to the end of a form value string.
| 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. |
| static Object attributeCustomValueFromString | ( | EOAttribute | attr, | |
| String | strVal, | |||
| String | encoding | |||
| ) | [static] |
Attempts to convert string values for attributes into the appropriate value class for the attribute. If the method is unable to convert the value, it returns null.
| 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. |
Attempts to convert string values for attributes into the appropriate value class for the attribute. If the method is unable to convert the value, it returns null.
| attr | The attribute for the value in question. | |
| strVal | The string value to be coerced. |
| static Object attributeValueFromString | ( | EOAttribute | attr, | |
| String | strVal, | |||
| String | encoding, | |||
| Format | formatter | |||
| ) | [static] |
Attempts to convert string values for attributes into the appropriate value class for the attribute. If the method is unable to convert the value, it returns null.
| 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. |
| static String byteArrayToHexString | ( | byte[] | block | ) | [static] |
Converts a byte array to hex string.
| block | byte array |
Converts ThisIsATest to this_is_a_test
| camelString | the StringWithCaps |
Capitalizes a given string.
| value | to be capitalized |
Capitalizes all the strings in a given string.
| value | to be capitalized |
| static boolean caseInsensitiveStartsWith | ( | String | stringToSearch, | |
| String | prefix, | |||
| int | toffset | |||
| ) | [static] |
Tests if the string starts with the specified prefix starting at the specified index ignoring case. This method is optimized so that it only converts the relevant substring of stringToSearch to lowercase before comparing it to the lowercase version of prefix.
| stringToSearch | string to check | |
| prefix | prefix to look for | |
| toffset | starting offset to perform the search |
Tests if the string starts with the specified prefix ignoring case. This method is optimized so that it only converts the relevant substring of stringToSearch to lowercase before comparing it to the lowercase version of prefix.
| stringToSearch | string to check | |
| prefix | prefix to look for |
Checks if any of the characters specified in characters is contained in the string specified by source.
| source | the String which might contain characters | |
| characters | the characters to check |
| static NSDictionary databaseOperationAsDictionary | ( | EODatabaseOperation | op | ) | [static, private] |
Calculates a default display name for a given key path. For instance for the key path: "foo.bar" the display name would be "Bar".
| key | to calculate the display name |
Java port of the distance algorithm.
The code below comes from the following post on http://mail.python.org Fuzzy string matching Magnus L. Hetland mlh@idt.ntnu.no 27 Aug 1999 15:51:03 +0200
Explanation of the distance algorithm...
The algorithm:
def distance(a,b): c = {} n = len(a); m = len(b)
for i in range(0,n+1): c[i,0] = i for j in range(0,m+1): c[0,j] = j
for i in range(1,n+1): for j in range(1,m+1): x = c[i-1,j]+1 y = c[i,j-1]+1 if a[i-1] == b[j-1]: z = c[i-1,j-1] else: z = c[i-1,j-1]+1 c[i,j] = min(x,y,z) return c[n,m]
It calculates the following: Given two strings, a and b, and three operations, adding, subtracting and exchanging single characters, what is the minimal number of steps needed to translate a into b?
The method is based on the following idea:
We want to find the distance between a[:x] and b[:y]. To do this, we first calculate
1) the distance between a[:x-1] and b[:y], adding the cost of a subtract-operation, used to get from a[:x] to a[:z-1];
2) the distance between a[:x] and b[:y-1], adding the cost of an addition-operation, used to get from b[:y-1] to b[:y];
3) the distance between a[:x-1] and b[:y-1], adding the cost of a *possible* exchange of the letter b[y] (with a[x]).
The cost of the subtraction and addition operations are 1, while the exchange operation has a cost of 1 if a[x] and b[y] are different, and 0 otherwise.
After calculating these costs, we choose the least one of them (since we want to use the best solution.)
Instead of doing this recursively, i.e. calculating ourselves "back" from the final value, we build a cost-matrix c containing the optimal costs, so we can reuse them when calculating the later values. The costs c[i,0] (from string of length n to empty string) are all i, and correspondingly all c[0,j] (from empty string to string of length j) are j.
Finally, the cost of translating between the full strings a and b (c[n,m]) is returned.
I guess that ought to cover it... --------------------------
| a | first string | |
| b | second string |
| static void dumpArray | ( | StringBuffer | sb, | |
| NSArray | array, | |||
| int | level | |||
| ) | [static, private] |
| static void dumpDictionary | ( | StringBuffer | sb, | |
| NSDictionary | dict, | |||
| int | level | |||
| ) | [static, private] |
| static void dumpObject | ( | StringBuffer | sb, | |
| Object | value, | |||
| int | level | |||
| ) | [static, private] |
| static String dumpObject | ( | Object | object | ) | [static] |
creates a readable debug string for some data types (dicts, arrays, adaptorOperations, databaseOperations)
Simple utility method that will return the string "" if the string passed in is null otherwise it will return the passed in string.
| s | string to test |
Escapes the given characters with the given escape character in _sourceString. This implementation is specifically designed for large strings. In the event that no characters are escaped, the original string will be returned with no new object creation. A null _sourceString will return null.
Example: sourceString = Mike's, escape chars = ', escape with = \, returns Mike\'s
| _escapeChars | the list of characters to escape | |
| _escapeWith | the escape character to use | |
| _sourceString | the string to escape the characters in. |
Escapes the apostrophes in a Javascript string with a backslash.
| sourceString | the source string to escape |
| static String escapeNonBasicLatinChars | ( | char | c | ) | [static] |
Escapes the given PCDATA string as CDATA.
| pcdata | The string to escape |
Removes the spaces in a given String
Removes line breaks and quotes the string if neccessary
| s |
Utility to convert from bytes without the try/catch. Throws an NSForwardException in the unlikely case that your encoding can't be found.
| bytes | string to convert | |
| encoding |
| static String fromUTF8Bytes | ( | byte | bytes[] | ) | [static] |
Utility to convert from UTF-8 bytes without the try/catch. Throws an NSForwardException in the unlikely case that your encoding can't be found.
| bytes | string to convert |
| static NSArray fuzzyMatch | ( | String | name, | |
| String | entityName, | |||
| String | propertyKey, | |||
| String | synonymsKey, | |||
| EOEditingContext | ec, | |||
| ERXFuzzyMatchCleaner | cleaner, | |||
| String | comparisonString | |||
| ) | [static] |
fuzzyMatch(String name, String entityName, String propertyKey, String synonymsKey, EOEditingContext ec, ERXFuzzyMatchCleaner cleaner, NSArray sortOrderings ) instead | static NSArray fuzzyMatch | ( | String | name, | |
| String | entityName, | |||
| String | propertyKey, | |||
| String | synonymsKey, | |||
| EOEditingContext | ec, | |||
| ERXFuzzyMatchCleaner | cleaner, | |||
| NSArray | sortOrderings | |||
| ) | [static] |
Fuzzy matching is useful for catching user entered typos. For example if a user is search for a company named 'Aple' within your application they aren't going to find it. Thus the idea of fuzzy matching, meaning you can define a threshold of 'how close can they be' type of thing.
| name | to be matched against | |
| entityName | name of the entity to perform the match against. | |
| propertyKey | to be matched against | |
| synonymsKey | allows objects to have additional values to be matched against in addition to just the value of the propertyKey | |
| ec | context to fetch data in | |
| cleaner | 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. |
| static String getSimpleBinaryName | ( | Class | clazz | ) | [static, private] |
"Borrowed" from 1.5's Class.getSimpleBinaryName
| static String getSimpleClassName | ( | Class | clazz | ) | [static] |
"Borrowed" from 1.5's Class.getSimpleClassName
| static byte [] hexStringToByteArray | ( | String | hexString | ) | [static] |
Converts a even-length, hex-encoded String to a byte array.
| hexString |
| static void indent | ( | StringBuffer | sb, | |
| int | level | |||
| ) | [static] |
| static void indent | ( | PrintWriter | writer, | |
| int | level | |||
| ) | [static] |
| static int indexOfNumericInString | ( | String | str, | |
| int | fromIndex | |||
| ) | [static] |
Locate the the first numeric character after fromIndex in the given string.
| str | string to scan |
| static int indexOfNumericInString | ( | String | str | ) | [static] |
Locate the the first numeric character in the given string.
| str | string to scan |
| static String insertString | ( | String | destinationString, | |
| String | contentToInsert, | |||
| int | insertOffset | |||
| ) | [static] |
Inserts the a string into a nother string at a particular offset.
| destinationString | the string to insert into | |
| contentToInsert | the string to insert | |
| insertOffset | the offset in destinationString to insert |
| static Integer integerWithString | ( | String | s | ) | [static] |
Calculates an Integer for a given string. The only advantage that this method has is to not throw a number format exception if the string is not correctly formatted. This method makes use of the ERXConstant.integerForString caching logic.
| s | string to caclulate an Integer from |
| static boolean isAsciiDigit | ( | char | c | ) | [static, private] |
"Borrowed" from 1.5's Class.isAsciiDigit
| static boolean isDigitsOnly | ( | String | aString | ) | [static] |
checks if the specified String contains only digits.
| aString | the string to check |
| static boolean isLettersOnly | ( | String | aString | ) | [static] |
checks if the specified String contains only Letters.
| aString | the string to check |
| static boolean isValueInRange | ( | int | value, | |
| String | rangeString | |||
| ) | [static] |
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".
| value | the value to check for | |
| rangeString | the range string to parse |
Pads a string to the specified number of chars by adding the the given pad char on the left side. If the string is longer than paddedLength, it is returned unchanged.
| string | the string to pad | |
| padChar | the character to pad with | |
| paddedLength | the length to pad to |
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.
| key | to be lookup in the strings file | |
| framework | name, specify app or null to perform the lookup in the application's resources. | |
| languages | array to search for the key in |
Gets a localized string for a given key in a given framework's Localizable strings file for the default language (English).
| key | to be lookup in the strings file | |
| framework | name, specify app or null to perform the lookup in the application's resources. |
Gets a localized string for a given key in the application's Localizable strings file for the default language (English).
| key | to be lookup in the strings file |
| static String localizedTemplateStringWithObjectForKey | ( | Object | o, | |
| String | key, | |||
| String | framework, | |||
| NSArray | languages | |||
| ) | [static] |
Uses the method 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 template | |
| key | to be lookup in the strings file | |
| framework | name, specify app or null to perform the lookup in the application's resources. | |
| languages | array to search for the key in |
| static String maskStringWithCharacter | ( | String | arg, | |
| char | mask, | |||
| int | beginIndex, | |||
| int | endIndex | |||
| ) | [static] |
Masks a given string with a single character in the substring specified by the begin and end indexes. Negative indexes count from the end of the string beginning with -1. For example, maskStringWithCharacter("Visa 4111111111111111", '*', 5, -4); will result in a string value of "Visa ************1111"
| arg | The string value to mask | |
| mask | The character mask | |
| beginIndex | 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 |
Returns a string case-matched against the original string. For instance, if originalString is "Mike" and newString is "john", this returns "John". If originalString is "HTTP" and newString is "something", this returns "SOMETHING".
| originalString | the original string to analyze the case of | |
| newString | the new string |
Generate an MD5 hash from a String.
| str | the string to hash | |
| encoding | MD5 operates on byte arrays, so we need to know the encoding to getBytes as |
| IOException |
Generate an MD5 hash as hex from a String.
| str | the string to hash | |
| encoding | MD5 operates on byte arrays, so we need to know the encoding to getBytes as |
| IOException |
Simple utility method that will return null if the string passed in is equal to "" otherwise it will return the passed in string.
| s | string to test |
| static int numberOfOccurrencesOfCharInString | ( | char | c, | |
| String | s | |||
| ) | [static] |
Counts the number of occurrences of a particular char in a given string.
| c | char to count in string | |
| s | string to look for specified char in. |
Matches strings like Quicksilver (NullPointerException is matched by "NPE"). The rule is basically just that all the letters of the search string must appear in the original string in the same order as the search string, but they are not required to be contiguous or case-matched.
| _str | the string to search in | |
| _searchString | the search string to look for |
Quote the given string with the provided quote symbols
| s | the string to quote | |
| quoteSymbol | - the quote symbol |
| static boolean regionMatches | ( | StringBuffer | str, | |
| int | toffset, | |||
| String | other, | |||
| int | ooffset, | |||
| int | len | |||
| ) | [static] |
It's ridiculous that StringBuffer doesn't have a .regionMatches like String. This is stolen from String and re-implemented on top of StringBuffer. It's slightly slower than String's because we have to call charAt instead of just accessing the underlying array, but so be it.
| str | the StringBuffer to compare a region of | |
| toffset | 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. removes any character which is in characters from the source string
| source | the string which will be modified | |
| characters | the characters that are not allowed to be in source |
removes any character which is not in characters from the source string
| source | the string which will be modified | |
| characters | the characters that are allowed to be in source |
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.
| version | string |
| static String replaceStringByStringInString | ( | String | old, | |
| String | newString, | |||
| String | buffer | |||
| ) | [static] |
Replaces a given string by another string in a string.
| old | string to be replaced | |
| newString | to be inserted | |
| buffer | string to have the replacement done on it |
Pads a string to the specified number of chars by adding the the given pad char on the right side. If the string is longer than paddedLength, it is returned unchanged.
| string | the string to pad | |
| padChar | the character to pad with | |
| paddedLength | the length to pad to |
Convenience method to call safeIdentifierName(source, "_", '_')
| source | String to make into a identifier name |
Convenience method to call safeIdentifierName(source, prefix, '_')
| source | String to make into a identifier name | |
| prefix | String to prefix source with to make it a valid identifier name |
Converts source to be suitable for use as an identifier in JavaScript. prefix is prefixed to source if the first character of source is not suitable to start an identifier (e.g. a number). Any characters in source that are not allowed in an identifier are replaced with replacement.
Character.isJavaIdentifierPart(char)
| source | String to make into a identifier name | |
| prefix | String to prefix source with to make it a valid identifier name | |
| replacement | character to use to replace characters in source that are no allowed in an identifier name |
| static void setAdjustement | ( | double | newAdjustement | ) | [static] |
Sets the base adjustment used for fuzzy matching
| newAdjustement | factor to be used. |
Appends a CSS class to an existing (possibly null) CSS class string.
| originalString | the original string | |
| cssClass | the new CSS class to append |
| static String stringByReplacingFirstOccurrenceOfStringWithString | ( | final String | sourceString, | |
| final String | stringToReplace, | |||
| final String | replacementString | |||
| ) | [static] |
Replaces the first occurrence of a string with another string in a string.
| sourceString | string to use on which to perform the replacement | |
| stringToReplace | string to replace in sourceString if it exists. | |
| replacementString | the string with which to replace stringToReplace. |
| static String stringByTruncatingStringToByteLengthInEncoding | ( | final String | inputString, | |
| final int | byteLength, | |||
| final String | encoding | |||
| ) | [static] |
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. This tends to be an issue with UTF-8 and Japanese characters because they're double- or triple-byte in UTF-8 and you need to be careful not to split in the middle of a multi-byte sequence.
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 truncate | |
| byteLength | maximum byte length | |
| encoding | encoding to use |
| static boolean stringContainsSpecialRegexCharacters | ( | String | s | ) | [static] |
checks if the String contains a character that has a special meaning in regex. This could used to ensure that username and passwords have no such characters.
| s | the string to check |
true if s contains one or multiple characters that have special meanings in regex. | static String stringFromDictionary | ( | NSDictionary | dict | ) | [static] |
Same as NSPropertySerialization except it sorts on keys first.
| dict |
Returns a string from the input stream using the default encoding.
| in | stream to read | |
| encoding | to be used, null will use the default |
| static String stringFromInputStream | ( | InputStream | in | ) | throws IOException [static] |
Returns a string from the input stream using the default encoding.
| in | stream to read |
Retrives a given string for a given name, extension and bundle.
| name | of the resource | |
| extension | of the resource, example: txt or rtf | |
| bundle | to look for the resource in |
Returns a string from the contents of the given URL.
| url | the URL to read from | |
| encoding | the string encoding to read with |
| IOException | if the connection fails |
| static String stringFromURL | ( | URL | url | ) | throws IOException [static] |
Returns a string from the contents of the given URL.
| url | the URL to read from |
| IOException | if the connection fails |
| static boolean stringIsNullOrEmpty | ( | String | s | ) | [static] |
Simple test if the string is either null or equal to "".
| s | string to test |
Reads the contents of a file given by a path into a string.
| path | to the file in the file system |
| static String stringWithContentsOfFile | ( | File | file | ) | [static] |
Reads the contents of a file given by a path into a string.
| file | path to the file in the file system |
String multiplication.
| n | the number of times to concatinate a given string | |
| s | string to be multipled |
Removes HTML characters from the given string.
| str | the string to remove HTML from |
Utility to convert to bytes without the try/catch. Throws an NSForwardException in the unlikely case that your encoding can't be found.
| string | string to convert | |
| encoding |
| static String toHexString | ( | char | c | ) | [static] |
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). Warning: Don't use this method when your default locale is Turkey. java.lang.String.toLowerCase is slow because (a) it uses a StringBuffer (which has synchronized methods), (b) it initializes the StringBuffer to the default size, and (c) it gets the default locale every time to test for name equal to "tr".
Returns a String by invoking toString() on each object from the array. After each toString() call the separator is appended to the buffer
| array | an object array from which to get a nice String representation | |
| separator | a separator which is displayed between the objects toString() value |
| static byte [] toUTF8Bytes | ( | String | string | ) | [static] |
Utility to convert to UTF-8 bytes without the try/catch. Throws an NSForwardException in the unlikely case that your encoding can't be found.
| string | string to convert |
Null-safe wrapper for java.lang.String.trim
| s | string to trim |
Uncapitalizes a given string.
| value | to be uncapitalized |
Converts this_is_a_test to ThisIsATest
| underscoreString | the string_with_underscores | |
| capitalize | if true, the first letter is capitalized |
Util to unescape entities. Entities not found in the set will be left intact.
| string | string to unescape | |
| map | map of entities |
Remove the quote symbols from the given string
| s | ||
| quoteSymbol |
Utility to decode an URL without the try/catch. Throws an NSForwardException in the unlikely case that ERXMessageEncoding.defaultEncoding() can't be found.
| string |
Utility to encode an URL without the try/catch. Throws an NSForwardException in the unlikely case that ERXMessageEncoding.defaultEncoding() can't be found.
| string |
NSArray _defaultTargetDisplayLanguages = new NSArray(DEFAULT_TARGET_DISPLAY_LANGUAGE) [static, private] |
Holds the array of default display languages. Holds a single entry for English.
double adjustement = 0.5 [static, protected] |
holds the base adjustment for fuzzy matching
final String DEFAULT_TARGET_DISPLAY_LANGUAGE = "English" [static, private] |
Holds the default display language, which is English
final char [] HEX_CHARS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' } [static] |
Holds the chars for hex encoding
final NSDictionary HTML_SAFE_UNESCAPES [static] |
Safe HTML entities to unescape (SYMBOL+ISO). This still prevents injection attacks.
final NSDictionary HTML_UNESCAPES [static] |
HTML entities to unescape (XML+SYMBOL+ISO).
final NSDictionary ISO_UNESCAPES [static] |
ISO entities to unescape.
Logger log = Logger.getLogger(ERXStringUtilities.class) [static, private] |
final NSArray SORT_ASCENDING [static] |
final NSArray SORT_DESCENDING [static] |
final String SpecialRegexCharacters = ".*[]{}()?\\+%$!^" [static] |
Holds characters that have special meaning for regex
final NSDictionary SYMBOL_UNESCAPES [static] |
Symbol entities to unescape.
final NSDictionary XML_UNESCAPES [static] |
XML entities to unescape.
1.5.8