![]() |
Hilfe bei Unit
Hoi,
ich habe 2 funktionen gemacht (die auch funktionieren) wenn ich sie in eine unit packe und die unit dann ich mein prog einbinde kann ich sie nicht kompilieren. Die Unit sieht so aus:
Delphi-Quellcode:
unit StrFuncs;
interface uses SysUtils; function GetTok(str: string; Tok: string; sep: char): string; function NumTok(str: string; sep: char): integer; implementation function GetTok(str: string; Tok: integer; sep: char): string; var index: integer; begin result := ''; if (str = '') or (str = sep) or (Tok = 0) or (sep = '') then exit; if (pos(sep, str) = 0) and (Tok = 1) then begin result := str; exit; end; str := str + sep; while pos(sep+sep, str) > 0 do delete(str, pos(sep+sep, str), 1); if pos(sep, str) = 1 then delete(str, 1, 1); index := 1; while pos(sep, str) > 0 do begin if Tok = index then begin result := copy(str, 1, pos(sep, str)-1); exit; end else begin delete(str, 1, pos(sep, str)); inc(index); end; end; end; function NumTok(str: string; sep: char): integer; begin result := 0; if (str = '') or (str = sep) or (sep = '') then exit; if pos(sep, str) = 0 then begin result := 1; exit; end; str := str + sep; while pos(sep+sep, str) > 0 do delete(str, pos(sep+sep, str), 1); if pos(sep, str) = 1 then delete(str, 1, 1); while pos(sep, str) > 0 do begin Delete(str, 1, pos(sep, str)); inc(result); end; end; end. fehler ist/sind: Zitat:
|
Re: Hilfe bei Unit
Die Methodendeklaration unterscheidet sich von der Implementation:
Delphi-Quellcode:
Einfach anpassen und der Compiler ist glücklich...
function GetTok(str: string; Tok: string; sep: char): string;
implementation function GetTok(str: string; Tok: integer; sep: char): string;
Delphi-Quellcode:
function GetTok(str: string; Tok: integer; sep: char): string;
implementation function GetTok(str: string; Tok: integer; sep: char): string; |
Re: Hilfe bei Unit
ahhhh, danke :)
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 03:59 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz