Autor Beitrag
tim4vfb
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 45



BeitragVerfasst: Do 22.01.04 09:51 
Wie schaffe ich es das ich einen String, dessen Länge < 10 ist, auf diese Länge mit Leestellen aufzufüllen?? Am besten die Leerstellen vor den Zeichen!
Chatfix
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1583
Erhaltene Danke: 10

Win 10, Win 8, Win 7, Win Vista, Win XP
VB.net (VS 2015), MsSQL (T-SQL), HTML, CSS, PHP, MySQL
BeitragVerfasst: Do 22.01.04 09:56 
Eine Ahnung obs eine Funktion gibt, aber mit einer Schleife z.B.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
for i := Length(DeinString) to 10 do
begin
  DeinString := ' ' + DeinString;
end;

_________________
Gehirn: ein Organ, mit dem wir denken, daß wir denken. - Ambrose Bierce
KidPaddle
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 351

WinXP,Linux
D7 Prof, XE7
BeitragVerfasst: Do 22.01.04 10:41 
ausblenden Delphi-Quelltext
1:
2:
  // '          ' = 10 Leerzeichen
  DeinString := DeinString + Copy('          '110 - Length(DeinString));


Gruß
KidPaddle
Chatfix
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1583
Erhaltene Danke: 10

Win 10, Win 8, Win 7, Win Vista, Win XP
VB.net (VS 2015), MsSQL (T-SQL), HTML, CSS, PHP, MySQL
BeitragVerfasst: Do 22.01.04 11:00 
Wenn dann aber

ausblenden Delphi-Quelltext
1:
DeinString :=  Copy('          ',  1,  10 - Length(DeinString)) + DeinString;					


Weil er wollte die Leerzeichen vorne...

_________________
Gehirn: ein Organ, mit dem wir denken, daß wir denken. - Ambrose Bierce
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: Do 22.01.04 11:14 
Es gibt da noch so eine nette kleine praktische Funktion, die nennt sich "StringOfChar()"... ratet mal was die macht? :roll:

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!
Chatfix
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1583
Erhaltene Danke: 10

Win 10, Win 8, Win 7, Win Vista, Win XP
VB.net (VS 2015), MsSQL (T-SQL), HTML, CSS, PHP, MySQL
BeitragVerfasst: Do 22.01.04 12:09 
Stimmt!

Hier ein Bsp für die Verwendung:

ausblenden Delphi-Quelltext
1:
DeinString := StringOfChar(' '10 - Length(DeinString)) + DeinString;					

_________________
Gehirn: ein Organ, mit dem wir denken, daß wir denken. - Ambrose Bierce