[delphi] replace spaties

Pagina: 1
Acties:

  • JSchut
  • Registratie: Februari 2002
  • Laatst online: 16:15
ik mp3-files op uit een directory en haal de gegevens eruit (artist en title).

de artisist staat in 30 bytes.
stel nou dat de naam van de artist 'got' is dan hou je dus 27 bytes over en deze worden bij de output als spaties weergegeven.

die spaties wil ik dan weghalen.

maar als de srtist 'g o t' is dan moeten die spaties uiteraard wel blijven staan

iemand een idee :?

PSN jschut_82 | Xbox: JSchut82


  • jelmervos
  • Registratie: Oktober 2000
  • Niet online

jelmervos

Simple user

Trim?
Trims leading and trailing spaces and control characters from a string.

"The shell stopped unexpectedly and Explorer.exe was restarted."


  • JSchut
  • Registratie: Februari 2002
  • Laatst online: 16:15
wow zo simpel dat ik daar zelf niet aangedacht heb ....... |:(

PSN jschut_82 | Xbox: JSchut82


  • jelmervos
  • Registratie: Oktober 2000
  • Niet online

jelmervos

Simple user

Op maandag 08 april 2002 14:50 schreef JSchut het volgende:
wow zo simpel dat ik daar zelf niet aangedacht heb ....... |:(
Tsja, je moet het maar net weten. :)

"The shell stopped unexpectedly and Explorer.exe was restarted."


  • TheLunatic
  • Registratie: April 2001
  • Laatst online: 09-07 16:41

TheLunatic

Ouwe boxen.

Of zelf maken:

while MP3Naam[Length(MP3Naam)]=' ' do Delete(MP3Naam, Length(MP3Naam),1);

Mother, will they like this song?


  • jelmervos
  • Registratie: Oktober 2000
  • Niet online

jelmervos

Simple user

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
function Trim(const S: string): string;
var
  I, L: Integer;
begin
  L := Length(S);
  I := 1;
  while (I <= L) and (S[I] <= ' ') do Inc(I);
  if I > L then Result := '' else
  begin
    while S[L] <= ' ' do Dec(L);
    Result := Copy(S, I, L - I + 1);
  end;
end;

:P :P

"The shell stopped unexpectedly and Explorer.exe was restarted."

Pagina: 1