[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'MaskEdit' (#lcl)

# FormatMaskText

Applies an edit mask to the specified string value.

## Declaration

Source position: maskedit.pp line 393

`function FormatMaskText(`
`const AEditMask: string;`
`const Value: string;`
`EnableSets: Boolean = False`
`):string;`

## Arguments

`AEditMask` |  | Edit mask applied to the specified content.
`Value` |  | Original content modified in the routine.
`EnableSets` |  | Enables or disables set notation in the edit mask.

## Function result

Value after applying the specified mask.

## Description

FormatMaskText is a String function used to apply an edit mask to the specified String value. FormatMaskText creates a temporary instance of TCustomMaskEdit that is used to apply the edit mask in AEditMask when required. The value in AEditMask is assigned to the EditMask property in TCustomMaskEdit.

The Value argument contains the data without any mask literals, escaped characters, or space characters inserted by the editing mask. When the IsMasked method in the TCustomMaskEdit returns True, the ApplyMaskToText method is used to generate the return value for the routine. To maintain Delphi compatibility, the GetTextWithoutSpaceChar is also called to translate space characters represented using the character in the mask field to the Space character (decimal 32).

The EnableSets argument indicates whether set notation, represented using '[' and ']' characters, are recognized in the edit mask. The value is assigned to the EnableSets property in TMaskEdit/TCustomMaskEdit. When set to False, the '[' and ']' characters used in set notation are treated as literal characters. When set to True, the optional or required set definition is added to the mask. The default value for the property is False.

When IsMasked is False, the unmodified content in Value is used as the return value.

## See also

TCustomMaskEdit.EditMask |  | Contains the mask characters classes and literals used to format/obscure the value for the control.
TCustomMaskEdit.IsMasked |  | True if a non-empty value has been assigned to EditMask.
TCustomMaskEdit.ApplyMaskToText |  | Applies the edit mask in the control to the specified value.
TCustomMaskEdit.GetTextWithoutSpaceChar |  | Gets the value for the control without the Space character literal used in the edit mask.