Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-03

oracle.jdevimpl.audit.util
Class Strings

java.lang.Object
  extended by oracle.jdevimpl.audit.util.Strings

public class Strings
extends java.lang.Object

String utilities. Some of these methods have reasonable JDK alternatives in newer JDKs.


Nested Class Summary
static class Strings.TokenIterator
          An iterator for the tokens in a string.
 
Field Summary
static java.lang.String LINE_SEPARATOR
           
 
Method Summary
static java.lang.StringBuffer append(java.lang.StringBuffer buffer, java.lang.Object object)
          Appends a string representation of an object to a string buffer.
static void append(java.lang.StringBuffer buffer, java.lang.String message, java.lang.Object[] arguments)
          Appends a formatted string from a template string and an array of arguments to a StringBuffer.
static void appendHtmlEscaped(java.lang.StringBuilder buffer, java.lang.String text)
          Escapes HTML meta-characters in a string into a buffer.
static java.lang.String capitalize(java.lang.String string)
          Capitalizes a string.
static java.lang.String capitalizeAll(java.lang.String string)
          Capitalizes each letter which follows a whitespace character in a string.
static java.lang.String capitalizeAndSeparateAll(java.lang.String string)
          Capitalizes each letter which follows a whitespace character in a string, and inserts a space before any uppercase letter preceded by a lower case letter.
static java.lang.String decapitalize(java.lang.String string)
          Decapitalizes a string.
static java.lang.String fill(char c, int length)
          Creates a string filled with a character.
static java.lang.String firstLine(java.lang.String string)
          Extracts the first line of a string.
static java.lang.String firstToken(java.lang.String string, char delimiter)
          Gets the first token in a string.
static java.lang.String firstToken(java.lang.String string, java.lang.String delimiters)
          Gets the first token in a string.
static java.lang.String htmlEscaped(java.lang.String text)
          Escapes HTML meta-characters in a string.
static java.lang.String lastToken(java.lang.String string, char delimiter)
          Gets the last token in a string.
static java.lang.String lastToken(java.lang.String string, java.lang.String delimiters)
          Gets the last token in a string.
static java.lang.String remove(java.lang.String string, java.lang.String substring)
          Removes the first occurrence of a substring.
static java.lang.String removeAll(java.lang.String string, java.lang.String substring)
          Removes all occurrences of a substring.
static java.lang.String removePrefix(java.lang.String string, java.lang.String prefix)
          Removes a prefix from a string, if present.
static java.lang.String removeSuffix(java.lang.String string, java.lang.String suffix)
          Removes a suffix from a string, if present.
static java.lang.String replace(java.lang.String string, java.lang.String substring, java.lang.String replacement)
          Replaces the first occurrence of a substring.
static java.lang.String replaceAll(java.lang.String string, java.lang.String substring, java.lang.String replacement)
          Replaces all occurrences of a substring.
static java.util.List<java.lang.String> tokens(java.lang.String string, char delimiter)
          Gets a list of the tokens in a string.
static java.lang.String toString(java.lang.Object object)
          Gets a string representation of an object.
static java.lang.String toString(java.lang.String message, java.lang.Object[] arguments)
          Gets a formatted string from a template string and an array of arguments.
static java.lang.String trim(java.lang.String string, char character)
          Gets a string trimmed of leading and trailing occurrences of a character.
 java.lang.String trim(java.lang.String string, java.lang.String characters)
          Gets a string trimmed of leading and trailing occurrences of set of characters.
static boolean wildcardMatch(java.lang.String string, java.lang.String pattern)
          Gets true if a string matches a pattern which may include wildcard characters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LINE_SEPARATOR

public static final java.lang.String LINE_SEPARATOR
Method Detail

capitalize

public static java.lang.String capitalize(java.lang.String string)
Capitalizes a string.


capitalizeAll

public static java.lang.String capitalizeAll(java.lang.String string)
Capitalizes each letter which follows a whitespace character in a string.


capitalizeAndSeparateAll

public static java.lang.String capitalizeAndSeparateAll(java.lang.String string)
Capitalizes each letter which follows a whitespace character in a string, and inserts a space before any uppercase letter preceded by a lower case letter.


decapitalize

public static java.lang.String decapitalize(java.lang.String string)
Decapitalizes a string.


htmlEscaped

public static java.lang.String htmlEscaped(java.lang.String text)
Escapes HTML meta-characters in a string.


appendHtmlEscaped

public static void appendHtmlEscaped(java.lang.StringBuilder buffer,
                                     java.lang.String text)
Escapes HTML meta-characters in a string into a buffer.


fill

public static java.lang.String fill(char c,
                                    int length)
Creates a string filled with a character.

Parameters:
c - The character to replicate.
length - The length of the string.

firstLine

public static java.lang.String firstLine(java.lang.String string)
Extracts the first line of a string.


remove

public static java.lang.String remove(java.lang.String string,
                                      java.lang.String substring)
Removes the first occurrence of a substring.


removeAll

public static java.lang.String removeAll(java.lang.String string,
                                         java.lang.String substring)
Removes all occurrences of a substring.


replace

public static java.lang.String replace(java.lang.String string,
                                       java.lang.String substring,
                                       java.lang.String replacement)
Replaces the first occurrence of a substring.


replaceAll

public static java.lang.String replaceAll(java.lang.String string,
                                          java.lang.String substring,
                                          java.lang.String replacement)
Replaces all occurrences of a substring.


removePrefix

public static java.lang.String removePrefix(java.lang.String string,
                                            java.lang.String prefix)
Removes a prefix from a string, if present.


removeSuffix

public static java.lang.String removeSuffix(java.lang.String string,
                                            java.lang.String suffix)
Removes a suffix from a string, if present.


trim

public static java.lang.String trim(java.lang.String string,
                                    char character)
Gets a string trimmed of leading and trailing occurrences of a character. If there are no leading and trailing occurrences of the characer, returns the same string.

Parameters:
string - The string to trim.
character - The character to trim from the string.

trim

public java.lang.String trim(java.lang.String string,
                             java.lang.String characters)
Gets a string trimmed of leading and trailing occurrences of set of characters. If there are no leading and trailing occurrences of the characer, returns the same string.

Parameters:
string - The string to trim.
characters - The characters to trim from the string.

tokens

public static java.util.List<java.lang.String> tokens(java.lang.String string,
                                                      char delimiter)
Gets a list of the tokens in a string. If there are n occurrences of the delimiter character in the string, there will be n + 1 tokens.

Parameters:
string - The string to tokenize.
delimiter - The character which delimits tokens.
Returns:
A list of strings.

firstToken

public static java.lang.String firstToken(java.lang.String string,
                                          char delimiter)
Gets the first token in a string.

Parameters:
string - The string to tokenize.
delimiter - The character which delimits tokens.
Returns:
The string which is the first token.

firstToken

public static java.lang.String firstToken(java.lang.String string,
                                          java.lang.String delimiters)
Gets the first token in a string.

Parameters:
string - The string to tokenize.
delimiters - The characters any of which delimit tokens.
Returns:
The string which is the first token.

lastToken

public static java.lang.String lastToken(java.lang.String string,
                                         char delimiter)
Gets the last token in a string.

Parameters:
string - The string to tokenize.
delimiter - The character which delimits tokens.
Returns:
The string which is the last token.

lastToken

public static java.lang.String lastToken(java.lang.String string,
                                         java.lang.String delimiters)
Gets the last token in a string.

Parameters:
string - The string to tokenize.
delimiters - The characters any of which delimit tokens.
Returns:
The string which is the last token.

wildcardMatch

public static boolean wildcardMatch(java.lang.String string,
                                    java.lang.String pattern)
Gets true if a string matches a pattern which may include wildcard characters. "*" matches zero or more of any character, "?" matches exactly one occurrence of any character. A wildcard character may be escaped so that it is matched as an ordinary character by prefixing it with a backslash ("\"). A backslash may be escaped by prefixing it with a backslash also.

Parameters:
string - The string to match.
pattern - The pattern to match against, containing wildcards.
Returns:
true if the string matches the pattern, false otherwise.

toString

public static java.lang.String toString(java.lang.Object object)
Gets a string representation of an object. The major difference between this method and String.valueOf is that this method formats arrays as collections. To catch arrays in collections, it also does its own formatting for Collection and Map classes.


toString

public static java.lang.String toString(java.lang.String message,
                                        java.lang.Object[] arguments)
Gets a formatted string from a template string and an array of arguments. The formatted string is the template string with occurrences of "{0}", "{1}", etcetera, replaced with the String representation of the corresponding argument.


append

public static void append(java.lang.StringBuffer buffer,
                          java.lang.String message,
                          java.lang.Object[] arguments)
Appends a formatted string from a template string and an array of arguments to a StringBuffer. The formatted string is the template string with occurrences of "{0}", "{1}", etcetera, replaced with the String representation of the corresponding argument.


append

public static java.lang.StringBuffer append(java.lang.StringBuffer buffer,
                                            java.lang.Object object)
Appends a string representation of an object to a string buffer. The major difference between this method and String.valueOf is that this method formats arrays as collections. To catch arrays that are elements of collections, it also does its own formatting for Collection and Map classes.


Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-03

Copyright © 1997, 2009, Oracle. All rights reserved.