Java Doc for StringUtil.java in  » Net » Terracotta » com » tc » 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 » Net » Terracotta » com.tc.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.tc.util.StringUtil

StringUtil
public class StringUtil (Code)
String utility methods.


Field Summary
final public static  StringEMPTY
    
final public static  StringNULL_STRING
    
final public static  charSPACE
    
final public static  StringSPACE_STRING
    


Method Summary
final public static  StringgetNonNull(String s, String nullToken)
     For a string s, if non-null return s, else return nullToken.
final public static  StringgetNonNull(String s)
     Get a non-null version of the String.
public static  StringindentLines(String source)
     Indent lines using a single tab by inserting them into source after line breaks and returning a new String.
public static  StringindentLines(String source, int indentLevel)
     Indent lines using tabs by inserting them into source after line breaks and returning a new String.
public static  StringBufferindentLines(StringBuffer source, int indentLevel)
     Indent lines using tabs by inserting them into source and returning source.
public static  StringBufferindentLines(StringBuffer source, int indentLevel, char indentChar)
     Indent lines in the StringBuffer (line breaks found at \n) with indentChar repeated indentLevel times.
public static  intindexOfStringBuffer(StringBuffer source, String search, int start)
     Find index of "search" in "source", starting at "start" index.
final public static  Stringreduce(String source)
     Reduces the size that a string occupies to the minimal possible by ensuring that the back-end char array contains exactly the characters that are needed, and no more.
final public static  StringreplaceAll(String source, String search, String replace, boolean skipQuotedStrings)
     Simple search/replace for non-pattern strings.
final public static  StringsafeToString(Object object)
     Normal toString(), but convert null to the StringUtil.NULL_STRING .
final public static  StringtoPaddedString(long value, int radix, int paddedWidth)
     Format value to string using radix, then prepend with 0's out to paddedWidth.
final public static  StringtoString(Object[] objs, String separator, String prefix, String postfix)
     Creates a String representation of an array of objects by calling toString on each one.
final public static  StringtoString(Object[] objs)
     Helper method to convert object array [a, b, c] to comma-separated string "a, b, c".

Field Detail
EMPTY
final public static String EMPTY(Code)
The empty string



NULL_STRING
final public static String NULL_STRING(Code)
A string representing a null value: ""



SPACE
final public static char SPACE(Code)
A space character



SPACE_STRING
final public static String SPACE_STRING(Code)
A space string





Method Detail
getNonNull
final public static String getNonNull(String s, String nullToken)(Code)
For a string s, if non-null return s, else return nullToken.
Parameters:
  s - The starting string
Parameters:
  nullToken - The null token s or nullToken depending on s



getNonNull
final public static String getNonNull(String s)(Code)
Get a non-null version of the String.
Parameters:
  s - The string Either s or the empty string if s was null



indentLines
public static String indentLines(String source)(Code)
Indent lines using a single tab by inserting them into source after line breaks and returning a new String.
Parameters:
  source - Source string, may NOT be null New string, updated with indents
throws:
  NullPointerException - If source is null



indentLines
public static String indentLines(String source, int indentLevel)(Code)
Indent lines using tabs by inserting them into source after line breaks and returning a new String.
Parameters:
  source - Source string, may NOT be null
Parameters:
  indentLevel - Number of tabs to insert, must be >= 0 Original buffer, updated
throws:
  IllegalArgumentException - If indentLevel < 0
throws:
  NullPointerException - If source is null



indentLines
public static StringBuffer indentLines(StringBuffer source, int indentLevel)(Code)
Indent lines using tabs by inserting them into source and returning source.
Parameters:
  source - Source buffer, may be null
Parameters:
  indentLevel - Number of tabs to insert, must be >= 0 Original buffer, updated
throws:
  IllegalArgumentException - If indentLevel < 0



indentLines
public static StringBuffer indentLines(StringBuffer source, int indentLevel, char indentChar)(Code)
Indent lines in the StringBuffer (line breaks found at \n) with indentChar repeated indentLevel times.
Parameters:
  source - Source buffer, may be null
Parameters:
  indentLevel - Number of chars to indent, must be >= 0
Parameters:
  indentChar - Indent character (usually ' ' or '\t') Original buffer, updated
throws:
  IllegalArgumentException - If indentLevel < 0



indexOfStringBuffer
public static int indexOfStringBuffer(StringBuffer source, String search, int start)(Code)
Find index of "search" in "source", starting at "start" index.
Parameters:
  source - Source buffer, must be non-null
Parameters:
  search - Search string, must be non-null
Parameters:
  start - Start index, should be 0<=startthrows:
  NullPointerException - If source or search is null



reduce
final public static String reduce(String source)(Code)
Reduces the size that a string occupies to the minimal possible by ensuring that the back-end char array contains exactly the characters that are needed, and no more. Note that this method doesn't modify the original string as they are immutable, a new string is returned instead.
Parameters:
  source - the string that needs to be reduced the reduced string, null if source is null



replaceAll
final public static String replaceAll(String source, String search, String replace, boolean skipQuotedStrings)(Code)
Simple search/replace for non-pattern strings. optionally skipping over quoted strings.
Parameters:
  source - the original string to perform the search/replace on, a modified version of this is returned, if nullthen null will be returned immediately
Parameters:
  search - the string to search for in source, if null then null is returned immediately
Parameters:
  replace - the string to replace search occurrences in source, if null then thesearch string is simply removed from source and not replaced with anything
Parameters:
  skipQuotedStrings - if true then quoted strings will be skipped over a modified version of source, or null if source or search arenull



safeToString
final public static String safeToString(Object object)(Code)
Normal toString(), but convert null to the StringUtil.NULL_STRING . Always a string, never null



toPaddedString
final public static String toPaddedString(long value, int radix, int paddedWidth)(Code)
Format value to string using radix, then prepend with 0's out to paddedWidth. If the formatted value is > paddedWidth, then the value is returned.
Parameters:
  value - Long value, must be >= 0
Parameters:
  radix - The radix to use when representing the value
Parameters:
  paddedWidth - The width to pad to by prepending 0 Padded formatted string value for the long value, never null



toString
final public static String toString(Object[] objs, String separator, String prefix, String postfix)(Code)
Creates a String representation of an array of objects by calling toString on each one. Formatting is controlled by the parameters.
Parameters:
  objs - (required) the array of objects to display
Parameters:
  separator - (optional) a string to place between each object
Parameters:
  prefix - (optional) a string to prefix each object with
Parameters:
  postfix - (optional) a string to append to each object a String representation of the array, never returns null



toString
final public static String toString(Object[] objs)(Code)
Helper method to convert object array [a, b, c] to comma-separated string "a, b, c".
Parameters:
  objs - Array of objects, can be null String, never null



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.