|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectSimpleTagSupport
AbstractSimpleTag
FormatTag
FormatString
public class FormatString
A formatter used to format strings. FormatString uses the following pattern syntax:
The '#' character gets replaced by the next character in the string getting formatted, while other characters get put in as literals. For example:
String "5555555555" with pattern "(###)###-####" would result in: (555)555-5555.
The '*' character will display all characters in the string at that point in the pattern. For example:
String "123456" with pattern "#-*!" would result in: 1-23456!
If a result with a '#' pr '*' character showing is desired, the '#' or '*' needs to be escaped with the '$' character. For example:
String "ABCD" with pattern "$#-####" would result in: #-ABCD.
To show a '$' in the result, the '$' character needs to be escaped. For example:
String "1234" with pattern "$$#,###" would result in: $1,234
If the truncate attribute is set to "true", characters in the string that exceed the pattern will be dropped. Otherwise, they will be appended to the end of the formatted string.
<netui:span value="2125555555"> <netui:formatString pattern="phone (###) ###-####"/> </netui:span>
Nested Class Summary | |
---|---|
static class |
FormatString.StringFormatter
Internal FormatTag.Formatter which performs its own string parsing and formatting. |
Nested classes/interfaces inherited from class FormatTag |
---|
FormatTag.Formatter |
Field Summary | |
---|---|
protected boolean |
truncate
|
Fields inherited from class FormatTag |
---|
_pattern |
Constructor Summary | |
---|---|
FormatString()
|
Method Summary | |
---|---|
void |
doTag()
Create the internal Formatter instance and perform the formatting. |
String |
getTagName()
Return the name of the Tag. |
void |
setTruncate(boolean truncate)
Sets whether or not pattern-exceeding characters should be dropped. |
Methods inherited from class FormatTag |
---|
getLocale, setCountry, setLanguage, setPattern |
Methods inherited from class AbstractSimpleTag |
---|
getBufferBody, getHtmlTag, getIdForTagId, getInlineError, getPageContext, getScriptReporter, getUserLocale, hasErrors, registerTagError, registerTagError, reportErrors, rewriteName, setNonEmptyValueAttribute, setRequiredValueAttribute, write |
Methods inherited from class SimpleTagSupport |
---|
findAncestorWithClass, getJspBody, getJspContext, getParent, setJspBody, setJspContext, setParent |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean truncate
Constructor Detail |
---|
public FormatString()
Method Detail |
---|
public String getTagName()
getTagName
in interface INetuiTag
getTagName
in class AbstractSimpleTag
public void setTruncate(boolean truncate)
truncate
- "true" or "false"public void doTag() throws JspException
doTag
in interface SimpleTag
doTag
in class SimpleTagSupport
JspException
- if a JSP exception has occurred
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |