Bali Share 1.1.18

oracle.bali.share.nls
Class StringUtils

java.lang.Object
  |
  +--oracle.bali.share.nls.StringUtils

public class StringUtils
extends java.lang.Object

StringUtils provides functions for manipulating mnemonics.


Field Summary
static int MNEMONIC_INDEX_NONE
           
 
Constructor Summary
StringUtils()
           
 
Method Summary
static int getMnemonicIndex(java.lang.String string)
          Returns the index of the inline mnemonic in the specified string.
static int getMnemonicKeyCode(java.lang.String string)
          Returns the key code for the mnemonic in the string.
static java.lang.String stripMnemonic(java.lang.String string)
          Removes non-displayable inline mnemonic characters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MNEMONIC_INDEX_NONE

public static final int MNEMONIC_INDEX_NONE
Constructor Detail

StringUtils

public StringUtils()
Method Detail

getMnemonicIndex

public static int getMnemonicIndex(java.lang.String string)
Returns the index of the inline mnemonic in the specified string.

This method assumes that inline mnemonics are indicated via the ampersand ('&') character. It returns the index of the first ampersand character followed by a non-ampersand character in the string. If no inline mnemonic character is found, MNEMONIC_INDEX_NONE is returned.

Strings which may contain mnemonics should be passed to stripMnemonic() to strip the inline mnemonic indicator as well as any escaped ampersands.

See Also:
stripMnemonic(java.lang.String)

getMnemonicKeyCode

public static int getMnemonicKeyCode(java.lang.String string)
Returns the key code for the mnemonic in the string. Returns VK_UNDEFINED if the string does not contain a mnemonic.

stripMnemonic

public static java.lang.String stripMnemonic(java.lang.String string)
Removes non-displayable inline mnemonic characters.

In order to specify a mnemonic character in a translatable string (eg. in a resource file), a special character is used to indicate which character in the string should be treated as the mnemonic. This method assumes that an ampersand ('&') character is used as the mnemonic indicator, and removes (single) ampersands from the input string. A double ampersand sequence is used to indicate that an ampersand should actually appear in the output stream, in which case one of the ampersands is removed.

Clients should call this method after calling StringUtils.getMnemonicIndex() and before displaying the string. The returned string should be used in place of the input string when displaying the string to the end user. The returned string may be the same as the input string if no mnemonic indicator characters are found, but this is not guaranteed.

See Also:
getMnemonicIndex(java.lang.String)

Bali Share 1.1.18