|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.myfaces.trinidadinternal.util.nls.StringUtils
public class StringUtils
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 java.lang.String |
stripMnemonic(java.lang.String string)
Removes non-displayable inline mnemonic characters. |
static java.lang.String |
truncateString(java.lang.String text,
int truncateAt)
Truncates a string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MNEMONIC_INDEX_NONE
Constructor Detail |
---|
public StringUtils()
Method Detail |
---|
public static java.lang.String truncateString(java.lang.String text, int truncateAt)
text
- the text valuetruncateAt
- the number of characters at which the
string should be truncated. Strings will never be truncated
to less than 13 characters.public static int getMnemonicIndex(java.lang.String 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.
stripMnemonic(java.lang.String)
public static java.lang.String stripMnemonic(java.lang.String string)
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.
getMnemonicIndex(java.lang.String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |