Java Doc for StringUtil.java in  » Template-Engine » freemarker-2.3.10 » freemarker » template » utility » 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 » Template Engine » freemarker 2.3.10 » freemarker.template.utility 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   freemarker.template.utility.StringUtil

StringUtil
public class StringUtil (Code)
Some text related utilities.
version:
   $Id: StringUtil.java,v 1.48 2005/06/01 22:39:08 ddekany Exp $




Method Summary
public static  StringFTLStringLiteralDec(String s)
     FTL string literal decoding. \\, \", \', \n, \t, \r, \b and \f will be replaced according to Java rules.
public static  StringFTLStringLiteralEnc(String s)
    
public static  StringHTMLEnc(String s)
     HTML encoding (does not convert line breaks).
public static  StringRTFEnc(String s)
     Rich Text Format encoding (does not replace line breaks).
public static  StringURLEnc(String s, String charset)
     URL encoding (like%20this).
public static  StringXMLEnc(String s)
     XML Encoding.
public static  StringXMLEncNA(String s)
     XML encoding without replacing apostrophes.
public static  StringXMLEncNQG(String s)
     XML encoding without replacing apostrophes and quotation marks and greater-than signs.
public static  StringXMLEncQAttr(String s)
     XML encoding for attributes valies quoted with " (not with '!).
public static  Stringcapitalize(String s)
    
public static  Stringchomp(String s)
     Removes the line-break from the end of the string.
public static  LocalededuceLocale(String input)
    
public static  booleangetYesNo(String s)
    
public static  booleanisXMLID(String name)
     whether the name is a valid XML tagname.(This routine might only be 99% accurate.
public static  StringjQuote(String s)
     Quotes string as Java Language string literal.
public static  StringjavaScriptStringEnc(String s)
     Escapes a String according the JavaScript string literal escaping rules.
public static  StringjavaStringEnc(String s)
     Escapes the String with the escaping rules of Java language string literals, so it is safe to insert the value into a string literal.
public static  StringleftPad(String s, int minLength)
     Pads the string at the left with spaces until it reaches the desired length.
public static  StringleftPad(String s, int minLength, char filling)
     Pads the string at the left with the specified character until it reaches the desired length.
public static  StringleftPad(String s, int minLength, String filling)
     Pads the string at the left with a filling pattern until it reaches the desired length.
public static  booleanmatchesName(String qname, String nodeName, String nsURI, Environment env)
     whether the qname matches the combination of nodeName, nsURI, and environment prefix settings.
public static  MapparseNameValuePairList(String s, String defaultValue)
     Parses a name-value pair list, where the pairs are separated with comma, and the name and value is separated with colon. The keys and values can contain only letters, digits and _.
public static  Stringreplace(String text, String oldsub, String newsub, boolean caseInsensitive, boolean firstOnly)
     Replaces all occurrences of a sub-string in a string.
Parameters:
  text - The string where it will replace oldsub withnewsub.
public static  StringrightPad(String s, int minLength)
     Pads the string at the right with spaces until it reaches the desired length.
public static  StringrightPad(String s, int minLength, char filling)
     Pads the string at the right with the specified character until it reaches the desired length.
public static  StringrightPad(String s, int minLength, String filling)
     Pads the string at the right with a filling pattern until it reaches the desired length.
public static  String[]split(String s, char c)
     Splits a string at the specified character.
public static  String[]split(String s, String sep, boolean caseInsensitive)
     Splits a string at the specified string.



Method Detail
FTLStringLiteralDec
public static String FTLStringLiteralDec(String s) throws ParseException(Code)
FTL string literal decoding. \\, \", \', \n, \t, \r, \b and \f will be replaced according to Java rules. In additional, it knows \g, \l, \a and \{ which are replaced with <, >, & and { respectively. \x works as hexadecimal character code escape. The character codes are interpreted according to UCS basic plane (Unicode). "f\x006Fo", "f\x06Fo" and "f\x6Fo" will be "foo". "f\x006F123" will be "foo123" as the maximum number of digits is 4. All other \X (where X is any character not mentioned above or End-of-string) will cause a ParseException.
Parameters:
  s - String literal without the surrounding quotation marks String with all escape sequences resolved
throws:
  ParseException - if there string contains illegal escapes



FTLStringLiteralEnc
public static String FTLStringLiteralEnc(String s)(Code)



HTMLEnc
public static String HTMLEnc(String s)(Code)
HTML encoding (does not convert line breaks). Replaces all '>' '<' '&' and '"' with entity reference



RTFEnc
public static String RTFEnc(String s)(Code)
Rich Text Format encoding (does not replace line breaks). Escapes all '\' '{' '}' and '"'



URLEnc
public static String URLEnc(String s, String charset) throws UnsupportedEncodingException(Code)
URL encoding (like%20this).



XMLEnc
public static String XMLEnc(String s)(Code)
XML Encoding. Replaces all '>' '<' '&', "'" and '"' with entity reference



XMLEncNA
public static String XMLEncNA(String s)(Code)
XML encoding without replacing apostrophes.
See Also:   StringUtil.XMLEnc(String)



XMLEncNQG
public static String XMLEncNQG(String s)(Code)
XML encoding without replacing apostrophes and quotation marks and greater-than signs.
See Also:   StringUtil.XMLEnc(String)



XMLEncQAttr
public static String XMLEncQAttr(String s)(Code)
XML encoding for attributes valies quoted with " (not with '!). Also can be used for HTML attributes that are quoted with ".
See Also:   StringUtil.XMLEnc(String)



capitalize
public static String capitalize(String s)(Code)



chomp
public static String chomp(String s)(Code)
Removes the line-break from the end of the string.



deduceLocale
public static Locale deduceLocale(String input)(Code)



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



isXMLID
public static boolean isXMLID(String name)(Code)
whether the name is a valid XML tagname.(This routine might only be 99% accurate. Should maybe REVISIT)



jQuote
public static String jQuote(String s)(Code)
Quotes string as Java Language string literal. Returns string "null" if s is null.



javaScriptStringEnc
public static String javaScriptStringEnc(String s)(Code)
Escapes a String according the JavaScript string literal escaping rules. The resulting string will not be quoted.

It escapes both ' and ". In additional it escapes > as \> (to avoid </script>). Furthermore, all characters under UCS code point 0x20, that has no dedicated escape sequence in JavaScript language, will be replaced with hexadecimal escape (\xXX).




javaStringEnc
public static String javaStringEnc(String s)(Code)
Escapes the String with the escaping rules of Java language string literals, so it is safe to insert the value into a string literal. The resulting string will not be quoted.

In additional, all characters under UCS code point 0x20, that has no dedicated escape sequence in Java language, will be replaced with UNICODE escape (\uXXXX).
See Also:   StringUtil.jQuote(String)




leftPad
public static String leftPad(String s, int minLength)(Code)
Pads the string at the left with spaces until it reaches the desired length. If the string is longer than this length, then it returns the unchanged string.
Parameters:
  s - the string that will be padded.
Parameters:
  minLength - the length to reach.



leftPad
public static String leftPad(String s, int minLength, char filling)(Code)
Pads the string at the left with the specified character until it reaches the desired length. If the string is longer than this length, then it returns the unchanged string.
Parameters:
  s - the string that will be padded.
Parameters:
  minLength - the length to reach.
Parameters:
  filling - the filling pattern.



leftPad
public static String leftPad(String s, int minLength, String filling)(Code)
Pads the string at the left with a filling pattern until it reaches the desired length. If the string is longer than this length, then it returns the unchanged string. For example: leftPad('ABC', 9, '1234') returns "123412ABC".
Parameters:
  s - the string that will be padded.
Parameters:
  minLength - the length to reach.
Parameters:
  filling - the filling pattern. Must be at least 1 characters long.Can't be null.



matchesName
public static boolean matchesName(String qname, String nodeName, String nsURI, Environment env)(Code)
whether the qname matches the combination of nodeName, nsURI, and environment prefix settings.



parseNameValuePairList
public static Map parseNameValuePairList(String s, String defaultValue) throws java.text.ParseException(Code)
Parses a name-value pair list, where the pairs are separated with comma, and the name and value is separated with colon. The keys and values can contain only letters, digits and _. They can't be quoted. White-space around the keys and values are ignored. The value can be omitted if defaultValue is not null. When a value is omitted, then the colon after the key must be omitted as well. The same key can't be used for multiple times.
Parameters:
  s - the string to parse.For example: "strong:100, soft:900".
Parameters:
  defaultValue - the value used when the value is omitted in akey-value pair. the map that contains the name-value pairs.
throws:
  java.text.ParseException - if the string is not a valid name-valuepair list.



replace
public static String replace(String text, String oldsub, String newsub, boolean caseInsensitive, boolean firstOnly)(Code)
Replaces all occurrences of a sub-string in a string.
Parameters:
  text - The string where it will replace oldsub withnewsub. String The string after the replacements.



rightPad
public static String rightPad(String s, int minLength)(Code)
Pads the string at the right with spaces until it reaches the desired length. If the string is longer than this length, then it returns the unchanged string.
Parameters:
  s - the string that will be padded.
Parameters:
  minLength - the length to reach.



rightPad
public static String rightPad(String s, int minLength, char filling)(Code)
Pads the string at the right with the specified character until it reaches the desired length. If the string is longer than this length, then it returns the unchanged string.
Parameters:
  s - the string that will be padded.
Parameters:
  minLength - the length to reach.
Parameters:
  filling - the filling pattern.



rightPad
public static String rightPad(String s, int minLength, String filling)(Code)
Pads the string at the right with a filling pattern until it reaches the desired length. If the string is longer than this length, then it returns the unchanged string. For example: rightPad('ABC', 9, '1234') returns "ABC412341". Note that the filling pattern is started as if you overlay "123412341" with the left-aligned "ABC", so it starts with "4".
Parameters:
  s - the string that will be padded.
Parameters:
  minLength - the length to reach.
Parameters:
  filling - the filling pattern. Must be at least 1 characters long.Can't be null.



split
public static String[] split(String s, char c)(Code)
Splits a string at the specified character.



split
public static String[] split(String s, String sep, boolean caseInsensitive)(Code)
Splits a string at the specified 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.