Java Doc for StringUtil.java in  » Database-Client » SQL-Workbench » workbench » 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 » SQL Workbench » workbench.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   workbench.util.StringUtil

StringUtil
public class StringUtil (Code)

author:
   support@sql-workbench.net


Field Summary
final public static  StringEMPTY_STRING
    
final public static  StringISO_DATE_FORMAT
    
final public static  StringISO_TIMESTAMP_FORMAT
    
final public static  SimpleDateFormatISO_TIMESTAMP_FORMATTER
    
final public static  StringISO_TZ_TIMESTAMP_FORMAT
    
final public static  SimpleDateFormatISO_TZ_TIMESTAMP_FORMATTER
    
final public static  StringLINE_TERMINATOR
    
final public static  PatternPATTERN_CRLF
    
final public static  PatternPATTERN_NON_LF
    
final public static  StringREGEX_CRLF
    
final public static  StringREGEX_SPECIAL_CHARS
    


Method Summary
final public static  booleanarraysEqual(String[] one, String[] other)
    
final public static  Stringcapitalize(String word)
     Capitalize the first word of the passed String.
public static  intcompareStrings(String value1, String value2, boolean ignoreCase)
    
public static  StringdecodeUnicode(String theString)
    
public static  voiddump(String value)
    
final public static  StringBuilderemptyBuffer()
    
public static  booleanendsWith(CharSequence s, String end)
    
public static  booleanendsWith(CharSequence s, char c)
    
final public static  booleanequalString(String one, String other)
    
final public static  booleanequalStringIgnoreCase(String one, String other)
    
final public static  booleanequalStringOrEmpty(String one, String other)
     Checks if both Strings are equal considering null values.
public static  StringescapeUnicode(String value, CharacterRange range)
    
public static  StringescapeUnicode(String value, String specialSaveChars, CharacterRange range)
    
public static  StringescapeUnicode(String value, String specialSaveChars, CharacterRange range, boolean alwaysUnicode)
    
public static  intfindFirstWhiteSpace(CharSequence data)
     Find the first non-quoted whitespace in the given String.
public static  intfindPattern(String regex, String data, int startAt)
    
public static  intfindPattern(Pattern p, String data, int startAt)
    
public static  intfindPreviousWhitespace(String data, int pos)
    
public static  intfindWordBoundary(String data, int pos, String wordBoundaries)
    
public static  StringformatNumber(int value, int length, boolean fillRight)
    
final public static  StringgetCurrentTimestampWithTZString()
    
public static  doublegetDoubleValue(String aValue, double aDefault)
    
public static  intgetIntValue(String aValue)
    
public static  intgetIntValue(String aValue, int aDefault)
    
public static  longgetLongValue(String aValue, long aDefault)
    
final public static  StringgetMaxSubstring(String s, int maxLen, String add)
    
final public static  StringgetMaxSubstring(String s, int maxLen)
    
public static  CharSequencegetOctalString(int input)
    
public static  StringgetPathSeparator()
    
public static  intgetRealLineLength(String line)
    
final public static  StringgetStartingWhiteSpace(String aLine)
    
final public static  StringgetWordLeftOfCursor(String text, int pos, String wordBoundaries)
    
final public static  booleanhasOpenQuotes(String data, char quoteChar)
    
public static  inthashCode(CharSequence val)
    
public static  intindexOf(CharSequence value, char c)
    
public static  intindexOf(CharSequence value, char c, int occurance)
    
final public static  booleanisEmptyString(CharSequence value)
     Checks if the given String is null or has a zero length.
public static  booleanisInteger(String value)
    
public static  booleanisLowerCase(String s)
    
public static  booleanisMixedCase(String s)
    
public static  booleanisNumber(String value)
    
public static  booleanisUpperCase(String s)
    
public static  booleanisWhitespace(CharSequence s)
    
final public static  booleanisWhitespaceOrEmpty(CharSequence value)
    
final public static  intlastIndexOf(CharSequence s, char c)
     Replacement for StringBuilder.lastIndexOf() which does a lot of object creation and copying to achieve this.
public static  booleanlineStartsWith(CharSequence text, int lineStartPos, String compareTo)
    
final public static  StringlistToString(Collection aList, char aDelimiter)
    
final public static  StringlistToString(Collection aList, char aDelimiter, boolean quoteEntries)
    
final public static  StringmakeFilename(String input)
     Remove all characters that might not be allowed in a filename from the input string.
public static  StringmakePlainLinefeed(String input)
     Replace various combinations of linefeeds in the input string with \n.
public static  intnumDigits(int x)
    
public static  StringpadRight(String input, int length)
    
public static  StringquoteRegexMeta(String str)
     Quote the characters in a String that have a special meaning in regular expression.
final public static  Stringreplace(String haystack, String needle, String replacement)
    
final public static  StringBuilderreplaceToBuffer(StringBuilder target, String haystack, String needle, String replacement)
     Replaces all occurances of needle in haystack with replacement and appends the resulting String to the passed target.
Parameters:
  target - the buffer to append the result to.
public static  Stringrtrim(String s)
    
public static  booleanstringToBool(String aString)
    
final public static  List<String>stringToList(String aString)
    
final public static  List<String>stringToList(String aString, String aDelimiter)
    
final public static  List<String>stringToList(String aString, String aDelimiter, boolean removeEmpty)
    
final public static  List<String>stringToList(String aString, String aDelimiter, boolean removeEmpty, boolean trimEntries)
    
final public static  List<String>stringToList(String aString, String aDelimiter, boolean removeEmpty, boolean trimEntries, boolean checkBrackets)
    
final public static  String[]toArray(Collection<String> strings)
    
final public static  StringtrimQuotes(String input)
    
public static  voidtrimTrailingWhitespace(StringBuilder value)
    

Field Detail
EMPTY_STRING
final public static String EMPTY_STRING(Code)



ISO_DATE_FORMAT
final public static String ISO_DATE_FORMAT(Code)



ISO_TIMESTAMP_FORMAT
final public static String ISO_TIMESTAMP_FORMAT(Code)



ISO_TIMESTAMP_FORMATTER
final public static SimpleDateFormat ISO_TIMESTAMP_FORMATTER(Code)



ISO_TZ_TIMESTAMP_FORMAT
final public static String ISO_TZ_TIMESTAMP_FORMAT(Code)



ISO_TZ_TIMESTAMP_FORMATTER
final public static SimpleDateFormat ISO_TZ_TIMESTAMP_FORMATTER(Code)



LINE_TERMINATOR
final public static String LINE_TERMINATOR(Code)



PATTERN_CRLF
final public static Pattern PATTERN_CRLF(Code)



PATTERN_NON_LF
final public static Pattern PATTERN_NON_LF(Code)



REGEX_CRLF
final public static String REGEX_CRLF(Code)



REGEX_SPECIAL_CHARS
final public static String REGEX_SPECIAL_CHARS(Code)





Method Detail
arraysEqual
final public static boolean arraysEqual(String[] one, String[] other)(Code)



capitalize
final public static String capitalize(String word)(Code)
Capitalize the first word of the passed String. (write the first character in uppercase, the rest in lower case) This does not loop through the entire string to capitalize every word.



compareStrings
public static int compareStrings(String value1, String value2, boolean ignoreCase)(Code)

Parameters:
  value1 - the first String, maybe null
Parameters:
  value2 - the second String, maybe null 0 if both are null



decodeUnicode
public static String decodeUnicode(String theString)(Code)



dump
public static void dump(String value)(Code)



emptyBuffer
final public static StringBuilder emptyBuffer()(Code)



endsWith
public static boolean endsWith(CharSequence s, String end)(Code)



endsWith
public static boolean endsWith(CharSequence s, char c)(Code)



equalString
final public static boolean equalString(String one, String other)(Code)



equalStringIgnoreCase
final public static boolean equalStringIgnoreCase(String one, String other)(Code)



equalStringOrEmpty
final public static boolean equalStringOrEmpty(String one, String other)(Code)
Checks if both Strings are equal considering null values. A null String and an empty String (length==0 or all whitespace) are considered equal as well (because both are "empty")
See Also:   StringUtil.isWhitespaceOrEmpty(CharSequence)



escapeUnicode
public static String escapeUnicode(String value, CharacterRange range)(Code)



escapeUnicode
public static String escapeUnicode(String value, String specialSaveChars, CharacterRange range)(Code)



escapeUnicode
public static String escapeUnicode(String value, String specialSaveChars, CharacterRange range, boolean alwaysUnicode)(Code)



findFirstWhiteSpace
public static int findFirstWhiteSpace(CharSequence data)(Code)
Find the first non-quoted whitespace in the given String.
Parameters:
  data - the data in which to search the position of the first whitespace or -1 if no whitespace was found.



findPattern
public static int findPattern(String regex, String data, int startAt)(Code)



findPattern
public static int findPattern(Pattern p, String data, int startAt)(Code)



findPreviousWhitespace
public static int findPreviousWhitespace(String data, int pos)(Code)



findWordBoundary
public static int findWordBoundary(String data, int pos, String wordBoundaries)(Code)



formatNumber
public static String formatNumber(int value, int length, boolean fillRight)(Code)



getCurrentTimestampWithTZString
final public static String getCurrentTimestampWithTZString()(Code)



getDoubleValue
public static double getDoubleValue(String aValue, double aDefault)(Code)



getIntValue
public static int getIntValue(String aValue)(Code)



getIntValue
public static int getIntValue(String aValue, int aDefault)(Code)



getLongValue
public static long getLongValue(String aValue, long aDefault)(Code)



getMaxSubstring
final public static String getMaxSubstring(String s, int maxLen, String add)(Code)



getMaxSubstring
final public static String getMaxSubstring(String s, int maxLen)(Code)



getOctalString
public static CharSequence getOctalString(int input)(Code)



getPathSeparator
public static String getPathSeparator()(Code)



getRealLineLength
public static int getRealLineLength(String line)(Code)
Returns the length of the line without any line ending characters



getStartingWhiteSpace
final public static String getStartingWhiteSpace(String aLine)(Code)



getWordLeftOfCursor
final public static String getWordLeftOfCursor(String text, int pos, String wordBoundaries)(Code)



hasOpenQuotes
final public static boolean hasOpenQuotes(String data, char quoteChar)(Code)



hashCode
public static int hashCode(CharSequence val)(Code)



indexOf
public static int indexOf(CharSequence value, char c)(Code)



indexOf
public static int indexOf(CharSequence value, char c, int occurance)(Code)



isEmptyString
final public static boolean isEmptyString(CharSequence value)(Code)
Checks if the given String is null or has a zero length. A String containing only whitespaces is not considered empty.
Parameters:
  value - the String to test



isInteger
public static boolean isInteger(String value)(Code)



isLowerCase
public static boolean isLowerCase(String s)(Code)



isMixedCase
public static boolean isMixedCase(String s)(Code)



isNumber
public static boolean isNumber(String value)(Code)



isUpperCase
public static boolean isUpperCase(String s)(Code)



isWhitespace
public static boolean isWhitespace(CharSequence s)(Code)



isWhitespaceOrEmpty
final public static boolean isWhitespaceOrEmpty(CharSequence value)(Code)
Checks if the given parameter is "empty", i.e: either null, length == 0 or contains only whitespace



lastIndexOf
final public static int lastIndexOf(CharSequence s, char c)(Code)
Replacement for StringBuilder.lastIndexOf() which does a lot of object creation and copying to achieve this. This implementation should be a lot faster for StringBuilder and StringBuffer, and will basically be the same for String objects.
Parameters:
  s - the string to search in
Parameters:
  c - the character to look for -1 if c was not found, the position of c in s otherwise



lineStartsWith
public static boolean lineStartsWith(CharSequence text, int lineStartPos, String compareTo)(Code)



listToString
final public static String listToString(Collection aList, char aDelimiter)(Code)
Create a String from the given Collection, where the elements are delimited with the supplied delimiter The elements of the Collection as a String
Parameters:
  aList - The list to process
Parameters:
  aDelimiter - The delimiter to use



listToString
final public static String listToString(Collection aList, char aDelimiter, boolean quoteEntries)(Code)
Create a String from the given list, where the elements are delimited with the supplied delimiter The elements of the Collection as a String
Parameters:
  aList - The list to process
Parameters:
  aDelimiter - The delimiter to use
Parameters:
  quoteEntries - if true, all entries are quoted with a double quote



makeFilename
final public static String makeFilename(String input)(Code)
Remove all characters that might not be allowed in a filename from the input string.
Parameters:
  input - the value to be used as a filename input value without any characters that might not be allowed for a filename converted to lowercase



makePlainLinefeed
public static String makePlainLinefeed(String input)(Code)
Replace various combinations of linefeeds in the input string with \n.
Parameters:
  input - input string with only \n linefeeds
See Also:   StringUtil.PATTERN_NON_LF



numDigits
public static int numDigits(int x)(Code)
Returns the number of Digits of the value
Parameters:
  x - the value to check the number of digits that x consists of



padRight
public static String padRight(String input, int length)(Code)



quoteRegexMeta
public static String quoteRegexMeta(String str)(Code)
Quote the characters in a String that have a special meaning in regular expression.



replace
final public static String replace(String haystack, String needle, String replacement)(Code)



replaceToBuffer
final public static StringBuilder replaceToBuffer(StringBuilder target, String haystack, String needle, String replacement)(Code)
Replaces all occurances of needle in haystack with replacement and appends the resulting String to the passed target.
Parameters:
  target - the buffer to append the result to. If target is null a new StringBuilder will be created
Parameters:
  haystack - the String in which to search the value
Parameters:
  needle - the value to search for
Parameters:
  replacement - the value with which needle is replaced the resulting buffer



rtrim
public static String rtrim(String s)(Code)



stringToBool
public static boolean stringToBool(String aString)(Code)



stringToList
final public static List<String> stringToList(String aString)(Code)



stringToList
final public static List<String> stringToList(String aString, String aDelimiter)(Code)



stringToList
final public static List<String> stringToList(String aString, String aDelimiter, boolean removeEmpty)(Code)



stringToList
final public static List<String> stringToList(String aString, String aDelimiter, boolean removeEmpty, boolean trimEntries)(Code)



stringToList
final public static List<String> stringToList(String aString, String aDelimiter, boolean removeEmpty, boolean trimEntries, boolean checkBrackets)(Code)
Parses the given String and creates a List containing the elements of the string that are separated by aDelimiter
Parameters:
  aString - the value to be parsed
Parameters:
  aDelimiter - the delimiter to user
Parameters:
  removeEmpty - flag to remove empty entries
Parameters:
  trimEntries - flag to trim entries (will be applied beore checking for empty entries)
Parameters:
  checkBrackets - flag to check for opening and closing brackets (delimiter inside brackets will not be taken into account) A List of Strings



toArray
final public static String[] toArray(Collection<String> strings)(Code)



trimQuotes
final public static String trimQuotes(String input)(Code)



trimTrailingWhitespace
public static void trimTrailingWhitespace(StringBuilder value)(Code)



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.