Jump to content
Fórum Script Brasil
  • 0

[resolvido] Recortar String Até *, Ou Espaço


schaukoski

Question

Olá pessoal...

estou procurando o comando para recortar o primeiro nome da pessoa, acho que algo com o TRIM

variavel := 'EDUARDO MOURA SCHAUKOSKI';

Trim(variavel)

resultado : EDUARDO

OU recortar até o '*'

Ex:

variavel := 'EDUARDO MOURA SCHAUKOSKI *DELPHI*';

TRIM(variavel)

resultado : EDUARDO MOURA SCHAUKOSKI

Muito Obrigado!

RESOLVIDO PESSOAL, UMA FUNCTION RESOLVEU MEU PROBLEMA! Agradeço!

Function Limpanome(nome:string) :string;
var
  nomeclean:string;
  i:integer;
begin
  for i:=1 to length(nome) do begin
    if copy(nome,i,1)<>'*' then begin
      nomeclean:=nomeclean+copy(nome,i,1);
    end else begin
      result := trim(nomeclean);
      exit;
    end;
  end;
  result := trim(nomeclean);
end;

Edited by schaukoski
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152k
    • Total Posts
      651.5k
×
×
  • Create New...