Java Doc for StringUtil.java in  » Testing » mockrunner-0.4 » com » mockrunner » util » common » 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 » Testing » mockrunner 0.4 » com.mockrunner.util.common 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.mockrunner.util.common.StringUtil

StringUtil
public class StringUtil (Code)
Simple util class for String related methods.




Method Summary
public static  voidappendObjectsAsString(StringBuffer buffer, List data)
     Appends the entries in the specified List as strings with a terminating "\n" after each row.
public static  voidappendTabs(StringBuffer buffer, int number)
     Appends number tabs (\t) to the buffer.
public static  intcompare(String string1, String string2)
     Compares two strings and returns the last index where the two string are equal.
public static  intcountMatches(String string, String other)
     Returns how many times string contains other.
public static  StringfieldToString(String fieldName, Object field)
     Helper method for toString() implementations. Returns a string "field name: value".
public static  StringlowerCase(String string, int index)
     Converts the character at the specified index to lowercase and returns the resulting string.
public static  StringlowerCase(String string, int startIndex, int endIndex)
     Converts the character in the specified index range to lowercase and returns the resulting string.
public static  booleanmatchesContains(String source, String target, boolean caseSensitive)
     Returns if source contains target, ignoring case, if caseSensitive is false.
public static  booleanmatchesExact(String source, String target, boolean caseSensitive)
     Returns if the specified strings are equal, ignoring case, if caseSensitive is false.
public static  booleanmatchesPerl5(String source, String target, boolean caseSensitive)
     Returns if the regular expression target matches source, ignoring case, if caseSensitive is false.
public static  StringreplaceAll(String source, String match, String replacement)
     Replaces all occurrences of match in source with replacement.
public static  String[]split(String string, String delim, boolean doTrim)
     Splits a string into tokens.



Method Detail
appendObjectsAsString
public static void appendObjectsAsString(StringBuffer buffer, List data)(Code)
Appends the entries in the specified List as strings with a terminating "\n" after each row.
Parameters:
  buffer - the buffer
Parameters:
  data - the List with the data



appendTabs
public static void appendTabs(StringBuffer buffer, int number)(Code)
Appends number tabs (\t) to the buffer.
Parameters:
  buffer - the buffer
Parameters:
  number - the number of tabs to append



compare
public static int compare(String string1, String string2)(Code)
Compares two strings and returns the last index where the two string are equal. If the first characters of the two string do not match or if at least one of the two strings is empty, -1 is returned.
Parameters:
  string1 - the first string
Parameters:
  string2 - the second string the last index where the strings are equal



countMatches
public static int countMatches(String string, String other)(Code)
Returns how many times string contains other.
Parameters:
  string - the string to search
Parameters:
  other - the string that is searched the number of occurences



fieldToString
public static String fieldToString(String fieldName, Object field)(Code)
Helper method for toString() implementations. Returns a string "field name: value". Handles null values, collections and arrays. If the field is a collection or an array, the returned string will be:
"field name 0: value0\nfield name 1: value1"
Parameters:
  fieldName - the field name
Parameters:
  field - the field value a suitable string for toString() implementations



lowerCase
public static String lowerCase(String string, int index)(Code)
Converts the character at the specified index to lowercase and returns the resulting string.
Parameters:
  string - the string to convert
Parameters:
  index - the index where the character is set to lowercase the converted string
throws:
  IndexOutOfBoundsException - if the index is out ofrange



lowerCase
public static String lowerCase(String string, int startIndex, int endIndex)(Code)
Converts the character in the specified index range to lowercase and returns the resulting string. If the provided endIndex is smaller or equal to startIndex, the endIndex is set to startIndex + 1.
Parameters:
  string - the string to convert
Parameters:
  startIndex - the index to start, inclusive
Parameters:
  endIndex - the index to end, exclusive the converted string
throws:
  IndexOutOfBoundsException - if the index is out ofrange



matchesContains
public static boolean matchesContains(String source, String target, boolean caseSensitive)(Code)
Returns if source contains target, ignoring case, if caseSensitive is false.
Parameters:
  source - the source String
Parameters:
  target - the target String
Parameters:
  caseSensitive - is the comparison case sensitive true if the strings matchesfalse otherwise



matchesExact
public static boolean matchesExact(String source, String target, boolean caseSensitive)(Code)
Returns if the specified strings are equal, ignoring case, if caseSensitive is false.
Parameters:
  source - the source String
Parameters:
  target - the target String
Parameters:
  caseSensitive - is the comparison case sensitive true if the strings matchesfalse otherwise



matchesPerl5
public static boolean matchesPerl5(String source, String target, boolean caseSensitive)(Code)
Returns if the regular expression target matches source, ignoring case, if caseSensitive is false.
Parameters:
  source - the source String
Parameters:
  target - the target String
Parameters:
  caseSensitive - is the comparison case sensitive true if the strings matchesfalse otherwise



replaceAll
public static String replaceAll(String source, String match, String replacement)(Code)
Replaces all occurrences of match in source with replacement.
Parameters:
  source - the source string
Parameters:
  match - the string that is searched
Parameters:
  replacement - the replacement string the modified string
throws:
  IllegalArgumentException - if any argument is null orif match is the empty string



split
public static String[] split(String string, String delim, boolean doTrim)(Code)
Splits a string into tokens. Similar to StringTokenizer except that empty tokens are recognized and added as null. With a delimiter of ";" the string "a;;b;c;;" will split into ["a"] [null] ["b"] ["c"] [null].
Parameters:
  string - the String
Parameters:
  delim - the delimiter
Parameters:
  doTrim - should each token be trimmed the array of tokens



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.