Entwickler-Ecke

Delphi Language (Object-Pascal) / CLX - Boolean als String


sabi_14 - Mo 07.07.08 14:43
Titel: Boolean als String
Hallo zusammen,
ich möchte gerne einen Boolean-Wert in einen String umwandeln, um
ihn nachher auszugeben.
Ich verwende Delphi 5 und dort funktioniert 'BoolToStr' nicht.
Weiss jemand, wie dass sonst geht?

Danke schonmal im Vorraus.

Grüsse
Sabi


Moderiert von user profile iconNarses: Topic aus Sonstiges (Delphi) verschoben am Mo 07.07.2008 um 14:54


nagel - Mo 07.07.08 14:47

Schreib dir die Funktion einfach, ca. so:

Delphi-Quelltext
1:
2:
3:
4:
Function BoolToStr(B: Boolean): String;
Begin
If B Then Result := 'True' Else Result := 'False';
End;


alex517 - Mo 07.07.08 14:48


Delphi-Quelltext
1:
2:
3:
4:
5:
6:
const
  cBoolStr: Array[Boolean] of String = ('Nein''Ja');
..

  x := false;
  s := cBoolStr[x];

alex