Java Doc for StringUtilities.java in  » Database-Client » iSQL-Viewer » org » isqlviewer » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database Client » iSQL Viewer » org.isqlviewer.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.isqlviewer.util.StringUtilities

StringUtilities
final public class StringUtilities (Code)
Generic String manipulation library for converting strings or working with text.


author:
   Mark A. Kobold <mkobold at isqlviewer dot com>
version:
   1.0





Method Summary
public static  intcharCount(String str, char c, boolean countEscaped)
     Helper method to count number of given characters in a string.

This will return number of character instances in the given string.

public static  String[]collapseToArray(String list, String delimiter)
     Collapses a comma delimted text to an array of strings.

This method is the opposite of the explode methods in this class.
See Also:   StringUtilities.explode(Collection)
Parameters:
  list - comma seperated list of values.
Parameters:
  delimiter - to used to distinguish the elements in the string list, for example ','.

public static  Collection<String>collapseToCollection(String list, String delimiter)
     Collapses a comma delimted text to a collection of strings.

This method is the opposite of the explode methods in this class.
See Also:   StringUtilities.explode(Collection)
Parameters:
  list - comma seperated list of values.
Parameters:
  delimiter - to used to distinguish the elements in the string list, for example ','.

public static  booleancompare(String s1, String s2)
     Compares to strings together to see if they are equal.

What seperates this method from a standard equals is that both strings can be null and they are still compared safely.
Parameters:
  s1 - first string to compare.
Parameters:
  s2 - second string to compare.

public static  StringdecodeASCII(String str)
     Method for decoding ASCII escaped character sequences for UNICODE characters.

This will decode text encoded in a fashion similar to the Java Properties encoding mechanisim.

public static  StringdecodeBase64(String text)
     Standard base64 decoding mechanisim.

This uses the internal sun base64 decoder.
Parameters:
  text - to decode using base64.

public static  StringdecryptText(String text, Key key, String transformation)
     Decrypts simple text using a key and specificed transformation.

This will get an instance of the Cipher object using the specified transformation.

public static  StringencodeASCII(String theString)
     Encodes method into an ASCI compatible form.
public static  StringencodeBase64(String text)
     Standard base64 encoding mechanisim.

This uses the internal sun base64 encoder.
Parameters:
  text - to encode using base64.

public static  StringencodeHTMLEntities(String theString)
     Encodes string safe for HTML.
public static  StringencodeMD5(String text)
     Encode text using an MD5 algorithim.


Parameters:
  text - to encode.

public static  StringencodeMD5Data(byte[] binaryData)
     Encodes MD5 Hashes into a conformed statisically unique identifier.


Parameters:
  binaryData - MD5 hash from the message digest.

public static  StringencodeXMLEntities(String str)
     Encodes XML reserved characters to their respective entities.

This will encode/change the following raw characters:

  • " = &quot;
  • > = &gt;
  • < = &lt;
  • & = &amp;
  • ' = &apos;

Parameters:
  str - to be encoded.
public static  StringencryptText(String text, Key key, String transformation)
     Encrypts simple text using a key and specified transformation.

This will get an instance of the Cipher object using the specified transformation.

public static  Stringexplode(Object[] list)
     Creates a comma seperated list of strings from a collection.


Parameters:
  list - of strings or objects to created csv string from.

public static  Stringexplode(Collection list)
     Creates a comma seperated list of strings from a collection.

For every object in the list, this method relys on the toString() of Object to apped to, so it is allowable to send a collection containing non-strings.
Parameters:
  list - of strings or objects to created csv string from.

public static  Stringexplode(Collection list, String delimiter)
     Creates a comma seperated list of strings from a collection.

For every object in the list, this method relys on the toString() of Object to apped to, so it is allowable to send a collection containing non-strings.
Parameters:
  list - of strings or objects to created csv string from.
Parameters:
  delimiter - delimiter to explode the list by, if null a comma (,) is used.

public static  StringforceTrim(String text)
     Forces the single character to be stripped from both ends of the string.

This method is mainly useful for stripping off enclosing quotation marks and the like.

public static  StringformatBreak(int length, String text, String newLine, boolean htmlBreak)
     Utility method for wrapping text to a specific width.

This method allows you to pragmatically wrap long sections of text to a specified length.

public static  StringgetFullHumanReadableTime(long milliseconds)
     Converts a long number representing milliseconds into human readable format.

This value is mainly for formating milli-seconds into something a bit more readable much like the getHumanReadableTime() method.

Instead of seeing large incoherent number of milli-seconds you can see something like '1.016m'= 1 minute 1 second or '1.05h' = 1 hour 3 minutes.
Parameters:
  milliseconds - to format into a string.

public static  StringgetHTMLColor(Color c)
     Creates HTML friendly format for Java Color.

creates a string format of a Color object by taking the RGB color values and converting them to the hexadecimal equivalent, for example Color.BLACK will be '#000000'

To get the color back from the value returned here, use the decode method on Color.
See Also:   Color.decode(java.lang.String)
Parameters:
  c - to encode into HTML friendly format.

public static  StringgetHumanReadableSize(long bytes)
     Converts a long number representing bytes into human readable format.

This value is mainly for formating values like a file size, memory size and so forth, so instead of seeing a large incoherent number you can see something like '308.123KB' or '9.68MB'
Parameters:
  bytes - to format into a string.

public static  StringgetHumanReadableTime(long milliseconds)
     Converts a long number representing milliseconds into human readable format.

This value is mainly for formating milli-seconds into something a bit more readable much like the getHumanReadableTime() method.

Instead of seeing large incoherent number of milli-seconds you can see something like '1.016m'= 1 minute 1 second or '1.05h' = 1 hour 3 minutes.
Parameters:
  milliseconds - to format into a string.

public static  StringgetNormalizedClassName(String fqcn)
     Gets a normalized class name without a package namespace.

This will strip of the package name of a fully qualified class name that usually comes from class.getName()
Parameters:
  fqcn - fully qualified class name to normalize.

public static  StringgetSystemProperty(String key, String def)
     Utility method for accessing a system property without a security permission.

This method will simply eat any security exception that could occur and return the default.
Parameters:
  key - of the system property to lookup.
Parameters:
  def - the default value to use if the property cannot be read.

public static  StringgetTypeStringForObject(Object o)
     Gets an SQL Type field string based on the given object.

Basically this method gets the field name that can be easily reflected back into the java.sql.Types object to get the integer SQL type that should be used.
See Also:   Types
See Also:   StringUtilities.getTypeforValue(int)
Parameters:
  o - to test.

public static  StringgetTypeforValue(int type)
     Gets the Field name corresponding to the given type value.

Simple reflection to find the field name that has the same value given.

public static  StringleftFill(String original, int maxLength)
     Prepends whitespace to a string to a sepecified length.

if leftFill("Bork",8) = '\ \ \ \ Bork'

spaces are escaped for clarity.
Parameters:
  original - text to prepend data to.
Parameters:
  maxLength - maximum size the length the text grows to.

public static  FontparseFontString(String s)
     Parses a font string to a Font object.

Complimentary method for re-creating the font objects formatted to a string by the getFontString(Font) of this object.

for information on the format of the font string see getFontString(Font)
Parameters:
  s - to parse for the font.

public static  StringremoveSubString(String source, String sub)
     Removes a substring from a given string.

If source equals something like 'hello world' and the sub equals 'ell' the returned value will be 'ho world'. Also it should be noted that this method is a case-insensitive operation, for example 'Hello World' with sub equal to 'LO' would produce 'Hel World'.
Parameters:
  source - string to remove sub string from.
Parameters:
  sub - to remove from source value.

public static  StringrightFill(String original, int maxLength)
     Appends whitespace to a string to a sepecified length.

if leftFill("Bork",8) = 'Bork\ \ \ \ '

spaces are escaped for clarity.
Parameters:
  original - text to append data to.
Parameters:
  maxLength - maximum size the length the text grows to.

public static  intsearchStringSet(String s, String chars)
     Searches a string for a set of characters.

This will return the first occurrence of any character that exists in both s and chars.

public static  StringstripCharacters(String s, String set)
     Method for removing a set of characters from a source string.

Strips characters from the given set string from the source string s.

public static  StringsubstituteVariables(String source, Properties props)
     Performs variable string substitution with a set of named parameters.

In similar fashion the the JVM and Jakarta projects this will perform string substitution on a string based on a set of properties using the names to create a dynamically formatted text, that is based on easy to create, as well as read source string.

Using the source text of 'The quick brown ${fast animal} jumps over the lazy ${lazy animal}' you would then set properties in the give props of 'fast animal' and 'lazy animal' with the respective values that you want to be used as a replacement to the ${} variables.

public static  NumbertoNumber(String possibleNumber)
     Somewhat agressive number conversion method.

This will attempt to parse normal number, local currency, and or a percentage.
Parameters:
  possibleNumber - to change to a number.

public static  StringtrimToSize(String text, int maxLength)
     Forces a string to be trimmed to a specified length.

Makes sure that the text is <= maxLength.




Method Detail
charCount
public static int charCount(String str, char c, boolean countEscaped)(Code)
Helper method to count number of given characters in a string.

This will return number of character instances in the given string. if the given string is null then a -1 will returned.

For example if the given string is "XXNNXXnxXnXN" and the char is 'n' it will return a value of two as this method is case sensitive.

Another example is if given the string 'X\nXxxNnN' with count escaped set to false will return 1 otherwise it will return 2.
Parameters:
  str - to check characters for.
Parameters:
  c - character to count
Parameters:
  countEscaped - true will included escaped characters as part of the count` number of occurrences of the character C in the given string.




collapseToArray
public static String[] collapseToArray(String list, String delimiter)(Code)
Collapses a comma delimted text to an array of strings.

This method is the opposite of the explode methods in this class.
See Also:   StringUtilities.explode(Collection)
Parameters:
  list - comma seperated list of values.
Parameters:
  delimiter - to used to distinguish the elements in the string list, for example ','. collection of string from tokens in the list.




collapseToCollection
public static Collection<String> collapseToCollection(String list, String delimiter)(Code)
Collapses a comma delimted text to a collection of strings.

This method is the opposite of the explode methods in this class.
See Also:   StringUtilities.explode(Collection)
Parameters:
  list - comma seperated list of values.
Parameters:
  delimiter - to used to distinguish the elements in the string list, for example ','. collection of string from tokens in the list.




compare
public static boolean compare(String s1, String s2)(Code)
Compares to strings together to see if they are equal.

What seperates this method from a standard equals is that both strings can be null and they are still compared safely.
Parameters:
  s1 - first string to compare.
Parameters:
  s2 - second string to compare. true if both of the given strings are equal.




decodeASCII
public static String decodeASCII(String str)(Code)
Method for decoding ASCII escaped character sequences for UNICODE characters.

This will decode text encoded in a fashion similar to the Java Properties encoding mechanisim. Such that \\uxxxx are converted to the proper characters.

In fact most of this code came from that private method contained there.
See Also:   StringUtilities.encodeASCII(String)
Parameters:
  str - to decode ASCII escaped character sequences from. decoded string.




decodeBase64
public static String decodeBase64(String text)(Code)
Standard base64 decoding mechanisim.

This uses the internal sun base64 decoder.
Parameters:
  text - to decode using base64. original text before base64 encoding.




decryptText
public static String decryptText(String text, Key key, String transformation) throws GeneralSecurityException(Code)
Decrypts simple text using a key and specificed transformation.

This will get an instance of the Cipher object using the specified transformation. With the given Cipher the bytes will be transformed into a new string through the Cipher.doFinal() method.

If null or a blank string is given for text, the value is immediately returned as is.
Parameters:
  text - that needs to be decrypted.
Parameters:
  key - to unlock the text with.
Parameters:
  transformation - the name of the transformation, e.g., DES/CBC/PKCS5Padding. decrypted string of the original text parameter.
throws:
  GeneralSecurityException - if an error occurs during decryption.
See Also:   Cipher.getInstance(java.lang.String)




encodeASCII
public static String encodeASCII(String theString)(Code)
Encodes method into an ASCI compatible form.

This method has the result equivalent the native2ascii tool provided by the JDK.

The value returned here is similar to that found in the Java properties output.
Parameters:
  theString - to be encoded encoded string.




encodeBase64
public static String encodeBase64(String text)(Code)
Standard base64 encoding mechanisim.

This uses the internal sun base64 encoder.
Parameters:
  text - to encode using base64. encoded text using base64.




encodeHTMLEntities
public static String encodeHTMLEntities(String theString)(Code)
Encodes string safe for HTML.

If encoding into HTML various entities will be encoded for proper HTML formatting.
Parameters:
  theString - to be encoded encoded string.




encodeMD5
public static String encodeMD5(String text)(Code)
Encode text using an MD5 algorithim.


Parameters:
  text - to encode. MD5 checksum of the text given.




encodeMD5Data
public static String encodeMD5Data(byte[] binaryData)(Code)
Encodes MD5 Hashes into a conformed statisically unique identifier.


Parameters:
  binaryData - MD5 hash from the message digest. encoded hash value.
See Also:   java.security.MessageDigest.digest




encodeXMLEntities
public static String encodeXMLEntities(String str)(Code)
Encodes XML reserved characters to their respective entities.

This will encode/change the following raw characters:

  • " = &quot;
  • > = &gt;
  • < = &lt;
  • & = &amp;
  • ' = &apos;

Parameters:
  str - to be encoded. String with standard encoded entities.



encryptText
public static String encryptText(String text, Key key, String transformation) throws GeneralSecurityException(Code)
Encrypts simple text using a key and specified transformation.

This will get an instance of the Cipher object using the specified transformation. With the given Cipher the bytes will be transformed into a new string through the Cipher.doFinal() method.

If null or a blank string is given for text, the value is immediately returned as is.
Parameters:
  text - that needs to be encrypted.
Parameters:
  key - to lock the text with.
Parameters:
  transformation - the name of the transformation, e.g., DES/CBC/PKCS5Padding. encrypted string of the original text parameter.
throws:
  GeneralSecurityException - if an error occurs during encryption.
See Also:   Cipher.getInstance(java.lang.String)




explode
public static String explode(Object[] list)(Code)
Creates a comma seperated list of strings from a collection.


Parameters:
  list - of strings or objects to created csv string from. a comma seperated list of values from the list.
See Also:   StringUtilities.explode(Collection)




explode
public static String explode(Collection list)(Code)
Creates a comma seperated list of strings from a collection.

For every object in the list, this method relys on the toString() of Object to apped to, so it is allowable to send a collection containing non-strings.
Parameters:
  list - of strings or objects to created csv string from. a comma seperated list of values from the list.




explode
public static String explode(Collection list, String delimiter)(Code)
Creates a comma seperated list of strings from a collection.

For every object in the list, this method relys on the toString() of Object to apped to, so it is allowable to send a collection containing non-strings.
Parameters:
  list - of strings or objects to created csv string from.
Parameters:
  delimiter - delimiter to explode the list by, if null a comma (,) is used. a comma seperated list of values from the list.




forceTrim
public static String forceTrim(String text)(Code)
Forces the single character to be stripped from both ends of the string.

This method is mainly useful for stripping off enclosing quotation marks and the like. this method will removes the first and last character of text, and return the result.

if the text length is less than 2 it will simply return a blank string.
Parameters:
  text - to strip first and last character from. stripped form of the text parameter.




formatBreak
public static String formatBreak(int length, String text, String newLine, boolean htmlBreak)(Code)
Utility method for wrapping text to a specific width.

This method allows you to pragmatically wrap long sections of text to a specified length. This can be help ful if the string is too long to show on one line to the user.

This also allows for HTML style breaks or '\n' style line breaks.
Parameters:
  length - maximum line length to wrap lines to.
Parameters:
  text - to to format and wrap.
Parameters:
  newLine - this is text insert with each new line created i.e. '\t'.
Parameters:
  htmlBreak - use HTML style <br/> or '\n' line breaks. formatted and wrapped text.




getFullHumanReadableTime
public static String getFullHumanReadableTime(long milliseconds)(Code)
Converts a long number representing milliseconds into human readable format.

This value is mainly for formating milli-seconds into something a bit more readable much like the getHumanReadableTime() method.

Instead of seeing large incoherent number of milli-seconds you can see something like '1.016m'= 1 minute 1 second or '1.05h' = 1 hour 3 minutes.
Parameters:
  milliseconds - to format into a string. human readable format for large milli-seconds intervals.




getHTMLColor
public static String getHTMLColor(Color c)(Code)
Creates HTML friendly format for Java Color.

creates a string format of a Color object by taking the RGB color values and converting them to the hexadecimal equivalent, for example Color.BLACK will be '#000000'

To get the color back from the value returned here, use the decode method on Color.
See Also:   Color.decode(java.lang.String)
Parameters:
  c - to encode into HTML friendly format. Hexadecimal representation of the color.




getHumanReadableSize
public static String getHumanReadableSize(long bytes)(Code)
Converts a long number representing bytes into human readable format.

This value is mainly for formating values like a file size, memory size and so forth, so instead of seeing a large incoherent number you can see something like '308.123KB' or '9.68MB'
Parameters:
  bytes - to format into a string. human readable format for larger byte counts.




getHumanReadableTime
public static String getHumanReadableTime(long milliseconds)(Code)
Converts a long number representing milliseconds into human readable format.

This value is mainly for formating milli-seconds into something a bit more readable much like the getHumanReadableTime() method.

Instead of seeing large incoherent number of milli-seconds you can see something like '1.016m'= 1 minute 1 second or '1.05h' = 1 hour 3 minutes.
Parameters:
  milliseconds - to format into a string. human readable format for large milli-seconds intervals.




getNormalizedClassName
public static String getNormalizedClassName(String fqcn)(Code)
Gets a normalized class name without a package namespace.

This will strip of the package name of a fully qualified class name that usually comes from class.getName()
Parameters:
  fqcn - fully qualified class name to normalize. class name only.




getSystemProperty
public static String getSystemProperty(String key, String def)(Code)
Utility method for accessing a system property without a security permission.

This method will simply eat any security exception that could occur and return the default.
Parameters:
  key - of the system property to lookup.
Parameters:
  def - the default value to use if the property cannot be read. the respective system property or the default if cannot be read.




getTypeStringForObject
public static String getTypeStringForObject(Object o)(Code)
Gets an SQL Type field string based on the given object.

Basically this method gets the field name that can be easily reflected back into the java.sql.Types object to get the integer SQL type that should be used.
See Also:   Types
See Also:   StringUtilities.getTypeforValue(int)
Parameters:
  o - to test. String that is a field name in the Types object.




getTypeforValue
public static String getTypeforValue(int type)(Code)
Gets the Field name corresponding to the given type value.

Simple reflection to find the field name that has the same value given. If the value cannot be found the text 'OTHER' will be returned.

This method will also return null if an error occurs during reflection.
Parameters:
  type - that corresponds to an SQL type. field name based on the value type.
See Also:   Types




leftFill
public static String leftFill(String original, int maxLength)(Code)
Prepends whitespace to a string to a sepecified length.

if leftFill("Bork",8) = '\ \ \ \ Bork'

spaces are escaped for clarity.
Parameters:
  original - text to prepend data to.
Parameters:
  maxLength - maximum size the length the text grows to. string left filled with white space to maxLength.
See Also:   StringUtilities.rightFill(String,int)




parseFontString
public static Font parseFontString(String s)(Code)
Parses a font string to a Font object.

Complimentary method for re-creating the font objects formatted to a string by the getFontString(Font) of this object.

for information on the format of the font string see getFontString(Font)
Parameters:
  s - to parse for the font. new Font object represented by the given string.




removeSubString
public static String removeSubString(String source, String sub)(Code)
Removes a substring from a given string.

If source equals something like 'hello world' and the sub equals 'ell' the returned value will be 'ho world'. Also it should be noted that this method is a case-insensitive operation, for example 'Hello World' with sub equal to 'LO' would produce 'Hel World'.
Parameters:
  source - string to remove sub string from.
Parameters:
  sub - to remove from source value. new string with sub removed from the source string.




rightFill
public static String rightFill(String original, int maxLength)(Code)
Appends whitespace to a string to a sepecified length.

if leftFill("Bork",8) = 'Bork\ \ \ \ '

spaces are escaped for clarity.
Parameters:
  original - text to append data to.
Parameters:
  maxLength - maximum size the length the text grows to. string right filled with white space to maxLength.
See Also:   StringUtilities.leftFill(String,int)




searchStringSet
public static int searchStringSet(String s, String chars)(Code)
Searches a string for a set of characters.

This will return the first occurrence of any character that exists in both s and chars. The return values is the index >=0 and <= s.length()-1;

If either s or chars is null or empty the method will immediately return -1.
Parameters:
  s - string to search
Parameters:
  chars - set of character to look for. first index of any character in chars within s.




stripCharacters
public static String stripCharacters(String s, String set)(Code)
Method for removing a set of characters from a source string.

Strips characters from the given set string from the source string s. for example the String 'XXJavaXxRuntime' with the set parameter being 'Xa' will results in the following string 'JvxRuntime'

This method is very useful for removing various different characters at once from a string.
Parameters:
  s - String to strip characters from.
Parameters:
  set - collection of characters to strip. new string that is s that contains no characters from set.




substituteVariables
public static String substituteVariables(String source, Properties props) throws ParseException(Code)
Performs variable string substitution with a set of named parameters.

In similar fashion the the JVM and Jakarta projects this will perform string substitution on a string based on a set of properties using the names to create a dynamically formatted text, that is based on easy to create, as well as read source string.

Using the source text of 'The quick brown ${fast animal} jumps over the lazy ${lazy animal}' you would then set properties in the give props of 'fast animal' and 'lazy animal' with the respective values that you want to be used as a replacement to the ${} variables. such that is 'fast animal' = 'fox' and 'lazy animal' = 'dog' the result would be the famous sentence of 'The quick brown fox jumps over the lazy dog'.

This method does support recursive variables such that a variable can reference another variable until either there is a stack overflow or there are no variables left to substitute.
Parameters:
  source - string to be formatted using variable substitution.
Parameters:
  props - set of variable names to variable values to be used for the substitution process. a formatted string with the variables properly substituted.
throws:
  ParseException - if a variable declaration is started but is not closed.




toNumber
public static Number toNumber(String possibleNumber)(Code)
Somewhat agressive number conversion method.

This will attempt to parse normal number, local currency, and or a percentage.
Parameters:
  possibleNumber - to change to a number. null if the string cannot be interpreted as a number.




trimToSize
public static String trimToSize(String text, int maxLength)(Code)
Forces a string to be trimmed to a specified length.

Makes sure that the text is <= maxLength. If text is null or blank the original text will be returned.

A trim() will occur before a substring is created, the substring is create iff the trimed version greater than the maxLength.
Parameters:
  text - to strip.
Parameters:
  maxLength - maximum size to trim to. the text parameter that does not exceed maxLength.




Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.