Sign in Join
FPDoc Onlineexperiment

FormatMaskText function

In unit MaskEdit

Applies an edit mask to the specified string value.

Declaration

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

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

An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.