Hallo,

ich habe ein Dokument, dass unter Openoffice erstellt wurde . Das ist
schon eine Weile her.

Jetzt gibt mir das eine falsche Ausgabe.
Anscheinend gibt mid() Komma, leerzeichen u.a. als 0 zurück.

hier der vollständige code wichtig ist nur a zu verfolgen.

Horst


sub test123
print c2zahl("22.376,93 $")
end sub

'''''''''''''##########
function c2zahl(stext as string) as double
dim stext2 as string
for f =1 to len(stext)
   a=mid(stext,f,1)
    if isnumeric(a) then stext2=stext2 & a
    if a="," then stext2=stext2 & a
    'if a="." then stext2=stext2 & a
next f
on error goto fehler
i=cdbl(trim(stext2))
c2zahl=i
exit function
fehler:
on error goto 0
c2zahl=""

end function

--
Liste abmelden mit E-Mail an: [email protected]
Probleme? 
https://de.libreoffice.org/hilfe-kontakt/mailing-listen/abmeldung-liste/
Tipps zu Listenmails: https://wiki.documentfoundation.org/Netiquette/de
Listenarchiv: https://listarchives.libreoffice.org/de/users/
Datenschutzerklärung: https://www.documentfoundation.org/privacy

Antwort per Email an