CyberTre icon

Remover Não Numéricos

CyberTre | PRO | 11/21/18 01:39:42 PM UTC | 0 ⭐ | 7369 👁️ | Never ⏰ | []
Pascal |

530 B

|

None

|

0 👍

/

0 👎

// antes
function RemoverNaoNumericos(const S: string): string;
var
  DIdx: Integer;
  SIdx: Integer;
begin
  SetLength(Result, Length(S));
  DIdx := 0;
  for SIdx := 1 to Length(S) do
    if S[SIdx] in ['0'..'9'] then
    begin
      Inc(DIdx);
      Result[DIdx] := S[SIdx]
    end;
  SetLength(Result, DIdx)
end;
 
// hoje
 
function TLibSGNStrings.RemoverNaoNumericos(ATexto: string): string;
var
  C:  Char;
begin
  Result := EmptyStr;
  for C in ATexto do
    Result := Result + IfThen(C.IsDigit,C);
end;

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎