# com.bea.wlw.netui.tags.html
FormatString Class

public class FormatString
extends `FormatTag`

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 '#' or '*' 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.

Attribute Descriptions
Attribute | Required | Runtime Expression Evaluation | Data Bindable
--- | --- | --- | ---
country | No | No | No
The country code used to determine the locale
language | No | No | No
The language code used to determine the locale
pattern | No | No | Read Only
The pattern used to format this string
truncate | No | No | No
A boolean specifying whether characters that exceed the pattern's length should be dropped.

Related Topics

<netui:format...> Tag Samples
``FormatDate``
``FormatNumber``

Hierarchy
  `Object`
  `TagSupport`
  `BodyTagSupport`
  `AbstractBaseTag`
  `FormatTag`
  `FormatString`

All Implemented Interfaces
  `BodyTag`, `IterationTag`, `Serializable`, `Tag`

## Field Summary

`protected boolean` | `truncate` Whether or not pattern-exceeding characters should be dropped.

Fields from com.bea.wlw.netui.tags.html`.`FormatTag``
``pattern`,`

Fields from com.bea.wlw.netui.tags`.`AbstractBaseTag``
``ATTR_GENERAL`, `ATTR_GENERAL_EXPRESSION`, `ATTR_JAVASCRIPT`, `ATTR_STYLE`, `CLASS`, `ID`, `JAVASCRIPT_STATUS`, `NAME`, `NETUI_UNIQUE_CNT`, `ONCLICK`, `ONDBLCLICK`, `ONKEYDOWN`, `ONKEYPRESS`, `ONKEYUP`, `ONMOUSEDOWN`, `ONMOUSEMOVE`, `ONMOUSEOUT`, `ONMOUSEOVER`, `ONMOUSEUP`, `STYLE`, `TABINDEX``

Fields from javax.servlet.jsp.tagext`.`BodyTagSupport``
`bodyContent`

Fields from javax.servlet.jsp.tagext`.`TagSupport``
`id, pageContext`

Fields from interface javax.servlet.jsp.tagext`.`BodyTag``
`EVAL_BODY_BUFFERED, EVAL_BODY_TAG`

Fields from interface javax.servlet.jsp.tagext`.`IterationTag``
`EVAL_BODY_AGAIN`

Fields from interface javax.servlet.jsp.tagext`.`Tag``
`EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE`

## Constructor Summary

FormatString()

## Method Summary

`public int` | `doStartTag`() Create the internal Formatter instance and perform the formatting.
`public `String`` | `getTagName`() Return the name of the Tag.
`public boolean` | `getTruncate`() Gets whether or not pattern-exceeding characters should be dropped.
`protected void` | `localRelease`() Release any acquired resources.
`public void` | `setTruncate`(boolean truncate) Sets whether or not pattern-exceeding characters should be dropped.

Methods from `com.bea.wlw.netui.tags.html.`FormatTag``
``getCountry`, `getLanguage`, `getLocale`, `getPattern`, `setCountry`, `setLanguage`, `setPattern``

Methods from `com.bea.wlw.netui.tags.`AbstractBaseTag``
``addTagIdMapping`, `evaluateAttributeToString`, `filter`, `filter`, `getJavaScriptUtils`, `getNearestForm`, `getScriptReporter`, `getUserLocale`, `localRelease`, `registerTagError`, `release`, `renderAttribute`, `rewriteName`, `write``

Methods from `javax.servlet.jsp.tagext.`BodyTagSupport``
`doAfterBody, doEndTag, doInitBody, doStartTag, getBodyContent, getPreviousOut, release, setBodyContent`

Methods from `javax.servlet.jsp.tagext.`TagSupport``
`doAfterBody, doEndTag, doStartTag, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue`

Methods from class `java.lang.`Object``
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods from interface `javax.servlet.jsp.tagext.`BodyTag``
`doInitBody, setBodyContent`

Methods from interface `javax.servlet.jsp.tagext.`IterationTag``
`doAfterBody`

Methods from interface `javax.servlet.jsp.tagext.`Tag``
`doEndTag, doStartTag, getParent, release, setPageContext, setParent`

## Field Detail

### truncate

    protected boolean truncate

  Whether or not pattern-exceeding characters should be dropped.

## Constructor Detail

### FormatString

    public FormatString()

## Method Detail

### doStartTag() Method

    public int doStartTag()
         throws JspException

Create the internal Formatter instance and perform the formatting.

Overrides
  `FormatTag.doStartTag()`

#### Exceptions

``JspException``
  if a JSP exception has occurred

### getTagName() Method

    public String getTagName()

Return the name of the Tag.

Overrides
  `AbstractBaseTag.getTagName()`

### getTruncate() Method

    public boolean getTruncate()

Gets whether or not pattern-exceeding characters should be dropped.

#### Returns

the truncate value ("true" or "false").

### localRelease() Method

    protected void localRelease()

Release any acquired resources.

Overrides
  `FormatTag.localRelease()`

### setTruncate(boolean) Method

    public void setTruncate(boolean truncate)

Sets whether or not pattern-exceeding characters should be dropped.

#### Parameters

truncate
  - "true" or "false"