Einzelnen Beitrag anzeigen

elyesa

Registriert seit: 15. Apr 2005
8 Beiträge
 
#4

Re: Bitte um Hilfe [C++ -> Delphi]

  Alt 3. Mär 2010, 16:50
hello,
danke für die hinweise.

also wenn ich nach den kommentar gehe "//strstr without case" wird hier nach einem string im string gesucht.
jedoch verstehe ich nicht warum die funktion als ergebnis einen pchar zurück gibt.

diese funktion wird wie folgt aufgerufen im c++ programm:

Code:
if (stristr(rInformation.pContentType, "image/") ||
    stristr(rInformation.pContentType, "video/") ||
    stristr(rInformation.pContentType,  "audio/") ||
   (stristr(rInformation.pContentType, "application/") && !stristr(rInformation.pContentType, "java")))
  //Don't send the reply
  rServerCheck=false;*/
meint ihr es wäre ok wenn ich diese funktion mit dieser ersetze (delhi fundamentals ):

Delphi-Quellcode:
function StrPMatchLen(const P: PAnsiChar; const Len: Integer;
    const M: CharSet): Integer;
var Q: PAnsiChar;
    L: Integer;
begin
  Q := P;
  L := Len;
  Result := 0;
  While L > 0 do
    if Q^ in M then
      begin
        Inc(Q);
        Dec(L);
        Inc(Result);
      end else
      exit;
end;

function StrMatchChar(const S: AnsiString; const M: CharSet): Boolean;
var L: Integer;
begin
  L := Length(S);
  Result := (L > 0) and (StrPMatchLen(Pointer(S), L, M) = L);
end;
danke und gruss
  Mit Zitat antworten Zitat