Formatierung #
Funktionen zur Formatierung von Zahlen, Datumswerten und XML-Texten.
FormatFloat #
FormatFloat(Format: String, Value: Double): String
Formatiert eine Fließkommazahl nach dem angegebenen Format-String (Delphi-Syntax).
Dim s
s = ellib.FormatFloat("#,##0.00", 1234.5)
MsgBox s
' Ergebnis: "1.234,50" (je nach Locale)
| Format | Beispiel (1234.5) | Beschreibung |
|---|---|---|
"#,##0.00" | 1.234,50 | Tausendertrenner, 2 Dezimalen |
"0.000" | 1234,500 | 3 Dezimalen, keine Tausendertrenner |
"#,##0" | 1.235 | Ganzzahl mit Tausendertrenner |
"0.00 EUR" | 1234,50 EUR | Mit Währungstext |
FormatDateTime #
FormatDateTime(Format: String, Value: DateTime): String
Formatiert einen Datums-/Zeitwert nach dem angegebenen Format-String (Delphi-Syntax).
Dim s
s = ellib.FormatDateTime("dd.mm.yyyy hh:nn:ss", Now)
MsgBox s
' Ergebnis z.B.: "02.03.2026 14:30:00"
| Format | Beispiel | Beschreibung |
|---|---|---|
"dd.mm.yyyy" | 02.03.2026 | Deutsches Datum |
"yyyy-mm-dd" | 2026-03-02 | ISO-Datum |
"hh:nn:ss" | 14:30:00 | Uhrzeit (nn = Minuten) |
"dd.mm.yyyy hh:nn" | 02.03.2026 14:30 | Datum und Uhrzeit |
Hinweis: In Delphi-Formatstrings steht nn für Minuten (nicht mm, da das bereits für den Monat verwendet wird).
Format4 #
Format4(Format: String, Value1: Variant, Value2: Variant, Value3: Variant, Value4: Variant): String
Formatiert bis zu vier Werte in einen String ein.
FormatXml #
FormatXml(XmlString: String): String
Formatiert einen XML-String mit Einrückungen für bessere Lesbarkeit.
Dim xml, formatted
xml = "<root><item>Test</item></root>"
formatted = ellib.FormatXml(xml)
MsgBox formatted
ShowXml #
ShowXml(XmlString: String): Variant
Zeigt einen XML-String formatiert in einem Dialogfenster an. Nützlich zum Debuggen.
Dim xml
xml = Client.ExecuteSql("SELECT TOP 1 * FROM Artikel FOR XML AUTO").Fields(0).Value
ellib.ShowXml xml
FixDecimal #
FixDecimal(Value: Variant): Variant
Korrigiert Dezimaltrennzeichen-Probleme bei Variant-Werten. Nützlich wenn Werte aus verschiedenen Quellen mit unterschiedlichen Locale-Einstellungen stammen.