mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-03 00:10:51 +02:00
* patch to implement MaskDoFormatText by Paul Ishenin
git-svn-id: trunk@12458 -
This commit is contained in:
parent
4e2676ca13
commit
2083396fbc
@ -48,6 +48,7 @@ Classes
|
|||||||
|
|
||||||
function FormatMaskText(const EditMask: string; const Value: string): string;
|
function FormatMaskText(const EditMask: string; const Value: string): string;
|
||||||
function FormatMaskInput(const EditMask: string): string;
|
function FormatMaskInput(const EditMask: string): string;
|
||||||
|
function MaskDoFormatText(const EditMask: string; const Value: string; Blank: Char): string;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -74,8 +75,8 @@ type
|
|||||||
SourcePosition,Position : Integer;
|
SourcePosition,Position : Integer;
|
||||||
FEditMask,FMask : string;
|
FEditMask,FMask : string;
|
||||||
SourceVal,ExitVal : string;
|
SourceVal,ExitVal : string;
|
||||||
Matched : Boolean;
|
FMatched : Boolean;
|
||||||
MissChar : Char;
|
FMissChar : Char;
|
||||||
State : TParseState;
|
State : TParseState;
|
||||||
procedure EvaluateExit;
|
procedure EvaluateExit;
|
||||||
procedure EvaluateMissing;
|
procedure EvaluateMissing;
|
||||||
@ -101,6 +102,8 @@ type
|
|||||||
procedure ExtractMask;
|
procedure ExtractMask;
|
||||||
function MaskPtr : Char;
|
function MaskPtr : Char;
|
||||||
function SourcePtr : Char;
|
function SourcePtr : Char;
|
||||||
|
property Matched: Boolean read FMatched write FMatched;
|
||||||
|
property MissChar: Char read FMissChar write FMissChar;
|
||||||
public
|
public
|
||||||
function ValidateInput : string;
|
function ValidateInput : string;
|
||||||
property Mask : string read FEditMask write SetMask;
|
property Mask : string read FEditMask write SetMask;
|
||||||
@ -571,6 +574,26 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{
|
||||||
|
Format Value string using EditMask, dont use 2d and 3d fields of EditMask,
|
||||||
|
set own Blank char and Matched = False
|
||||||
|
}
|
||||||
|
function MaskDoFormatText(const EditMask: string; const Value: string; Blank: Char): string;
|
||||||
|
var
|
||||||
|
msk : TMaskUtils;
|
||||||
|
begin
|
||||||
|
Result := '';
|
||||||
|
msk := TMaskUtils.Create;
|
||||||
|
try
|
||||||
|
msk.Mask := EditMask;
|
||||||
|
msk.Value := Value;
|
||||||
|
msk.Matched := False;
|
||||||
|
msk.MissChar := Blank;
|
||||||
|
Result := msk.ValidateInput;
|
||||||
|
finally
|
||||||
|
msk.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user