Mudanças entre as edições de "Tiny Types"
De Grupo Acert
Linha 99: | Linha 99: | ||
function GetFormatted: string; | function GetFormatted: string; | ||
+ | |||
public | public | ||
class operator Implicit(const CPF: string): TCPF; | class operator Implicit(const CPF: string): TCPF; | ||
Linha 113: | Linha 114: | ||
uses | uses | ||
− | + | MaskUtils, StrUtils, SysUtils; | |
function Clear(const Doc: string): string; | function Clear(const Doc: string): string; | ||
Linha 136: | Linha 137: | ||
class operator TCNPJ.Implicit(const CNPJ: string): TCNPJ; | class operator TCNPJ.Implicit(const CNPJ: string): TCNPJ; | ||
begin | begin | ||
− | |||
Result.FUnformatted := Clear(CNPJ); | Result.FUnformatted := Clear(CNPJ); | ||
− | |||
end; | end; | ||
function TCNPJ.GetFormatted: string; | function TCNPJ.GetFormatted: string; | ||
begin | begin | ||
− | |||
Result := MaskUtils.FormatMaskText('00.000.000/0000-00;0; ', FUnformatted); | Result := MaskUtils.FormatMaskText('00.000.000/0000-00;0; ', FUnformatted); | ||
− | |||
end; | end; | ||
class operator TCNPJ.Implicit(const CNPJ: TCNPJ): string; | class operator TCNPJ.Implicit(const CNPJ: TCNPJ): string; | ||
begin | begin | ||
− | |||
Result := CNPJ.FUnformatted; | Result := CNPJ.FUnformatted; | ||
− | |||
end; | end; | ||
Linha 226: | Linha 221: | ||
class operator TCPF.Implicit(const CPF: string): TCPF; | class operator TCPF.Implicit(const CPF: string): TCPF; | ||
begin | begin | ||
− | |||
Result.FUnformatted := Clear(CPF); | Result.FUnformatted := Clear(CPF); | ||
− | |||
end; | end; | ||
function TCPF.GetFormatted: string; | function TCPF.GetFormatted: string; | ||
begin | begin | ||
− | |||
Result := MaskUtils.FormatMaskText('000.000.000-00;0; ', FUnformatted); | Result := MaskUtils.FormatMaskText('000.000.000-00;0; ', FUnformatted); | ||
− | |||
end; | end; | ||
class operator TCPF.Implicit(const CPF: TCPF): string; | class operator TCPF.Implicit(const CPF: TCPF): string; | ||
begin | begin | ||
− | |||
Result := CPF.FUnformatted; | Result := CPF.FUnformatted; | ||
− | |||
end; | end; | ||