Java Doc for StringUtil.java in  » Portal » stringbeans-3.5 » com » nabhinc » 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 » Portal » stringbeans 3.5 » com.nabhinc.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.nabhinc.util.StringUtil

StringUtil
public class StringUtil (Code)
Provides utility methods for string manipulation.
author:
   Padmanabh Dabke
author:
   (c) 2001,2003 Nabh Information Systems, Inc. All Rights Reserved.


Field Summary
public static  StringLINE_FEED
     Line feed string.
final static  String[]transform
    


Method Summary
final public static  StringencodeHTML(String str)
    
final public static  StringencodeHTML(String str, boolean encodeNewLine)
    
final public static  voidencodeHTML(String str, StringBuffer ret)
    
final public static  voidencodeHTML(String str, StringBuffer ret, boolean encodeNewline)
    
final public static  StringencodeXML(String str)
    
final public static  voidencodeXML(String str, StringBuffer ret)
    
public static  StringescapeJavascript(String str)
    
public static  StringextractHTML(String str)
     Extract (keep) JUST the HTML from the String.
public static  StringextractLastToken(String path, String delim)
     Extracts the substring after last delimiter.
public static  StringextractName(String path)
     Convinience method that calls extractLast token with / as the delimiter.
public static  StringextractParentPath(String path)
     Returns substring upto but not including the last occurence of / in the original string. null if path is null.
public static  StringgetErrorStackTraceString(Throwable ex)
    
public static  StringgetParentPath(String childPath)
    
public static  booleanisNotNullOrEmpty(String paramVal)
    
public static  booleanisNullOrEmpty(String paramValue)
    
public static  Stringjoin(String[] elements, String delimiter)
     Joins the array of string into one string with the specified delimiter.
public static  voidmain(String[] args)
     Main method for testing StringUtil class.
public static  StringremoveHTML(String str, boolean addSpace)
     Taken from Roller blogger Remove occurences of html, defined as any text between the characters "<" and ">".
final public static  StringremoveNewLine(String str)
    
public static  StringremoveNonAlphanumeric(String str)
     Remove occurences of non-alphanumeric characters.
public static  StringreplaceNonAlphanumeric(String str)
     Replaces occurences of non-alphanumeric characters with an underscore.
public static  StringreplaceNonAlphanumeric(String str, char subst)
     Replaces occurences of non-alphanumeric characters with a supplied char.
public static  StringreplacePathSeparator(String path)
     Replace all occurrence of "/" in the specified path with the system's path separator. This helper method might not be needed in the future if java.lang.String's replaceAll() has overcome the replacement of double back-slashes ("\\").
public static  String[]split(String str, String delimiter)
     Spits a string into an array of strings using the specified delimiter.
public static  int[]splitAsInts(String str, String delimiter)
     Spits a string into an array of ints using the specified delimiter.
public static  Stringsubstitute(String str, String orig, String sub)
     Substitutes first occurance of a substring by another string and returns it.
public static  StringtransformToURL(String path, String basePath)
     Transform relative or absolute path to a URL format.
public static  StringtruncateNicely(String str, int lower, int upper, String appendToEnd)
     This method based on code from the String taglib at Apache Jakarta: http://cvs.apache.org/viewcvs/jakarta-taglibs/string/src/org/apache/taglibs/string/util/StringW.java?rev=1.16&content-type=text/vnd.viewcvs-markup Copyright (c) 1999 The Apache Software Foundation.
public static  StringtruncateText(String str, int lower, int upper, String appendToEnd)
    
public static  StringwrapInCDATA(String txt)
     Puts CDATA stuff around the text and returns it.

Field Detail
LINE_FEED
public static String LINE_FEED(Code)
Line feed string. Useful in writing multiline text files.



transform
final static String[] transform(Code)





Method Detail
encodeHTML
final public static String encodeHTML(String str)(Code)



encodeHTML
final public static String encodeHTML(String str, boolean encodeNewLine)(Code)



encodeHTML
final public static void encodeHTML(String str, StringBuffer ret)(Code)



encodeHTML
final public static void encodeHTML(String str, StringBuffer ret, boolean encodeNewline)(Code)



encodeXML
final public static String encodeXML(String str)(Code)



encodeXML
final public static void encodeXML(String str, StringBuffer ret)(Code)



escapeJavascript
public static String escapeJavascript(String str)(Code)



extractHTML
public static String extractHTML(String str)(Code)
Extract (keep) JUST the HTML from the String.
Parameters:
  str -



extractLastToken
public static String extractLastToken(String path, String delim)(Code)
Extracts the substring after last delimiter. Used for picking the file name out of a path string. null if path is null, empty string is path is just thetoken, substring after the last occurrence of the delimiter inall other cases.
Parameters:
  path - Original string
Parameters:
  delim - Delimiter



extractName
public static String extractName(String path)(Code)
Convinience method that calls extractLast token with / as the delimiter. Substring after the last occurrence of /
Parameters:
  path - Original string



extractParentPath
public static String extractParentPath(String path)(Code)
Returns substring upto but not including the last occurence of / in the original string. null if path is null. Substring uptobut not including / in all other cases.
Parameters:
  path - Original string



getErrorStackTraceString
public static String getErrorStackTraceString(Throwable ex)(Code)



getParentPath
public static String getParentPath(String childPath)(Code)



isNotNullOrEmpty
public static boolean isNotNullOrEmpty(String paramVal)(Code)



isNullOrEmpty
public static boolean isNullOrEmpty(String paramValue)(Code)



join
public static String join(String[] elements, String delimiter)(Code)
Joins the array of string into one string with the specified delimiter. Returns null if the supplied string array is null. Returns an empty string if that array is of length 0. Creation date: (9/1/99 5:48:36 PM) Concatenated string
Parameters:
  elements - Array of strings to be joined.
Parameters:
  delimiter - Separator



main
public static void main(String[] args)(Code)
Main method for testing StringUtil class. Creation date: (10/4/99 2:16:31 PM)
Parameters:
  args - Command line arguments.



removeHTML
public static String removeHTML(String str, boolean addSpace)(Code)
Taken from Roller blogger Remove occurences of html, defined as any text between the characters "<" and ">". Optionally replace HTML tags with a space.
Parameters:
  str -
Parameters:
  addSpace -



removeNewLine
final public static String removeNewLine(String str)(Code)



removeNonAlphanumeric
public static String removeNonAlphanumeric(String str)(Code)
Remove occurences of non-alphanumeric characters.



replaceNonAlphanumeric
public static String replaceNonAlphanumeric(String str)(Code)
Replaces occurences of non-alphanumeric characters with an underscore.



replaceNonAlphanumeric
public static String replaceNonAlphanumeric(String str, char subst)(Code)
Replaces occurences of non-alphanumeric characters with a supplied char.



replacePathSeparator
public static String replacePathSeparator(String path)(Code)
Replace all occurrence of "/" in the specified path with the system's path separator. This helper method might not be needed in the future if java.lang.String's replaceAll() has overcome the replacement of double back-slashes ("\\").
Parameters:
  path - The path for path with system-dependent path separator character.



split
public static String[] split(String str, String delimiter)(Code)
Spits a string into an array of strings using the specified delimiter. Returns null if the string is null. Returns the original string into an array of size 1 if the delimiter is null or an empty string. An array of strings that were delimited by the specifieddelimiter.
Parameters:
  str - String to be split.
Parameters:
  delimiter - Separator string.



splitAsInts
public static int[] splitAsInts(String str, String delimiter)(Code)
Spits a string into an array of ints using the specified delimiter. Returns null if the string is null. Returns one int parsed from the entire string if the delimiter is null or an empty string. An array of strings that were delimited by the specifieddelimiter.
Parameters:
  str - String to be split.
Parameters:
  delimiter - Separator string.



substitute
public static String substitute(String str, String orig, String sub)(Code)
Substitutes first occurance of a substring by another string and returns it. Creation date: (11/21/2001 11:30:37 PM) java.lang.String
Parameters:
  str - String in which the substitution will occure
Parameters:
  orig - Substring to be replaced
Parameters:
  sub - Substitute string



transformToURL
public static String transformToURL(String path, String basePath)(Code)
Transform relative or absolute path to a URL format. If a relative path is provided, the base path is required. The base path can be a local file system path, e.g.: C:/document or in a URL format, e.g.: http://localhost



truncateNicely
public static String truncateNicely(String str, int lower, int upper, String appendToEnd)(Code)
This method based on code from the String taglib at Apache Jakarta: http://cvs.apache.org/viewcvs/jakarta-taglibs/string/src/org/apache/taglibs/string/util/StringW.java?rev=1.16&content-type=text/vnd.viewcvs-markup Copyright (c) 1999 The Apache Software Foundation. Author: timster@mac.com
Parameters:
  str -
Parameters:
  lower -
Parameters:
  upper -
Parameters:
  appendToEnd -



truncateText
public static String truncateText(String str, int lower, int upper, String appendToEnd)(Code)



wrapInCDATA
public static String wrapInCDATA(String txt)(Code)
Puts CDATA stuff around the text and returns it. Escaped text
Parameters:
  txt - Original text string



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.