Hi,
kein Bug.
Handbuch:
SubstringBefore (STRINGWERT1, STRINGWERT2)
liefert das Anfangsstück von STRINGWERT1, wenn STRINGWERT2 das Endstück
ist.
Z.B. hat
SubstringBefore ("C:\programme\staroffice\program\soffice.exe",
"\program\soffice.exe")
den Wert
"C:\programme\staroffice"
In den von Dir verwendeten Beispielen ist STRINGWERT2 nicht das Endstück.
Ich empfehle hier die Verwendung von splitstring und takestring.
Bei mir liefert der Code:
Code: Alles auswählen
comment ""
comment "-------------------------------------"
comment "Testing: "
comment "SubstringBefore"
set $ConstTest$ = "C:\programme\staroffice"
set $CompValue$ = SubstringBefore ("C:\programme\staroffice\program\soffice.exe","\program\soffice.exe")
if ($ConstTest$ = $CompValue$)
comment "passed"
else
set $TestResult$ = "not o.k."
LogWarning "failed"
endif
folgendes Log:
Code: Alles auswählen
[5] [1.7.2010 11:31:50] comment:
[5] [1.7.2010 11:31:50] comment: -------------------------------------
[5] [1.7.2010 11:31:50] comment: Testing:
[5] [1.7.2010 11:31:50] comment: SubstringBefore
[1] [1.7.2010 11:31:50]
[1] [1.7.2010 11:31:50] Set $ConstTest$ = "C:\programme\staroffice"
[6] [1.7.2010 11:31:50] The value of the variable is now: "C:\programme\staroffice"
[1] [1.7.2010 11:31:50]
[1] [1.7.2010 11:31:50] Set $CompValue$ = SubstringBefore ("C:\programme\staroffice\program\soffice.exe","\program\soffice.exe")
[6] [1.7.2010 11:31:50] The value of the variable is now: "C:\programme\staroffice"
[1] [1.7.2010 11:31:50]
[1] [1.7.2010 11:31:50] If
[5] [1.7.2010 11:31:50] $ConstTest$ = $CompValue$ <<< result true
[5] [1.7.2010 11:31:50] ($ConstTest$ = $CompValue$) <<< result true
[1] [1.7.2010 11:31:50] Then
[5] [1.7.2010 11:31:50] comment: passed
[1] [1.7.2010 11:31:50]
[1] [1.7.2010 11:31:50] Else
[1] [1.7.2010 11:31:50] EndIf
Ansonsten hat p.grass recht, dass es sinnvoll und dringend empfohlen ist Variablennamen mit $ vorne und hinten zu Kennzeichnen.
Weiterhin empfehlen wir unsere Supportverträge für den produktiv Betrieb:
http://uib.de/www/opsi/service_support/ ... index.html
gruss
d.oertel
gruss
d.oertel