Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.1.0)

E17493-02

oracle.javatools.util
Class StringUtil

java.lang.Object
  extended by oracle.javatools.util.StringUtil

public final class StringUtil
extends java.lang.Object

String utilities.


Field Summary
static int FILEPATH_MAX_DISPLAY_LENGTH
           
 
Method Summary
static java.lang.String addMnemonicToLabelIfNotPresentAlready(java.lang.String label, java.lang.Integer mnemonic)
          Adds the character represented by the given mnemonic to the given label, only if the label does not already contain such character.
static java.lang.String assembleTokens(java.lang.String[] tokens, java.lang.String delimiters)
          Assemble the given tokens into a single string delimited by the given delimiters.
static java.lang.String[] getTokenArray(java.lang.String string, java.lang.String delimiters)
           
static java.lang.String removeMnemonic(java.lang.String text, char mnemonic)
          Removes the given mnemonic if present in the given text in between parenthesis.
static java.lang.String stripMnemonic(java.lang.String string)
           
static java.lang.String textWithoutMnemonic(javax.swing.Action action)
          Returns the text of the given action, removing any mnemonic attached to the end of such text, if present in the given text in between parenthesis.
static java.lang.String truncateFileNameForMessage(java.lang.String path)
          Truncate a file path for a message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILEPATH_MAX_DISPLAY_LENGTH

public static final int FILEPATH_MAX_DISPLAY_LENGTH
See Also:
Constant Field Values
Method Detail

truncateFileNameForMessage

public static java.lang.String truncateFileNameForMessage(java.lang.String path)
Truncate a file path for a message. The file path is truncated from the middle, and whenever possible, partially truncated directory names are avoided.

Parameters:
path - a file path
Returns:
if the filePath is less than a specific size (80 characters), the original string. If more than 80 characters, the string is truncated in a way that preserves the start and end of the path.

getTokenArray

public static java.lang.String[] getTokenArray(java.lang.String string,
                                               java.lang.String delimiters)

assembleTokens

public static java.lang.String assembleTokens(java.lang.String[] tokens,
                                              java.lang.String delimiters)
Assemble the given tokens into a single string delimited by the given delimiters.

Parameters:
tokens - the tokens to be assembled (must not be null or empty)
delimiters - the delimiters used to separate the tokens (must not be null or empty)
Returns:
a single string of all the tokens separated by the delimiters
Throws:
java.lang.IllegalArgumentException - if either the tokens or delimiters is null or empty

stripMnemonic

public static java.lang.String stripMnemonic(java.lang.String string)

textWithoutMnemonic

public static java.lang.String textWithoutMnemonic(javax.swing.Action action)
Returns the text of the given action, removing any mnemonic attached to the end of such text, if present in the given text in between parenthesis.

For example, if text of the action is "Hello(H)", this method will return "Hello".

Parameters:
action - the given action.
Returns:
the text of the given action, without any mnemonics at the end.

removeMnemonic

public static java.lang.String removeMnemonic(java.lang.String text,
                                              char mnemonic)
Removes the given mnemonic if present in the given text in between parenthesis.

Parameters:
text - the text that may contain the mnemonic.
mnemonic - the mnemonic to remove.
Returns:
the the text with the mnemonic removed (if it had it in the first place.)

addMnemonicToLabelIfNotPresentAlready

public static java.lang.String addMnemonicToLabelIfNotPresentAlready(java.lang.String label,
                                                                     java.lang.Integer mnemonic)
Adds the character represented by the given mnemonic to the given label, only if the label does not already contain such character.

For example, if the label is "ABC" and the mnemonic is "D", the result of this method will be "ABC(D)".

Parameters:
label - the label.
mnemonic - the mnemonic value. If null, the label is returned unmodified.
Returns:
the label containing the mnemonic.

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.1.0)

E17493-02

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