![]() |
Pos info ???
kann ich pos sagen das er erst ab einer gewissen stelle sucht ???
lg, Gigant02 |
Re: Pos info ???
![]() |
Re: Pos info ???
@SubData: Falsch, gibt es in Delphi 5 noch nicht :roll: Aber in der CodeLib findest Du
![]() ...:cat:... |
Re: Pos info ???
Zitat:
Delphi-Quellcode:
substr := 'A';
s := 'ABCABC'; Anfang := 2; i := pos(substr, copy(s, Anfang, length(s))); j := i + Anfang - 1; // i = 3 weil pos('A','BCABC') = 3; // j = 4 weil das 2. A in 'ABCABC' an der 4. Stelle ist |
Re: Pos info ???
:wall: Ich sollte mir angewöhnen auf die Delphi Versionen zu achten...
Aber die Lösung mit dem Copy ist natürlich auch gut :) |
Re: Pos info ???
Zitat:
...:cat:... |
Re: Pos info ???
die löhsung mit dem Copy ist sehr gut die hat mir weiter geholfen
besten dank |
Re: Pos info ???
Zitat:
Der Orginal Quelltext von Borland sieht so aus:
Delphi-Quellcode:
{ *********************************************************************** }
{ Delphi Runtime Library } { Copyright (c) 1995-2001 Borland Software Corporation } { *********************************************************************** } ... { PosEx searches for SubStr in S and returns the index position of SubStr if found and 0 otherwise. If Offset is not given then the result is the same as calling Pos. If Offset is specified and > 1 then the search starts at position Offset within S. If Offset is larger than Length(S) then PosEx returns 0. By default, Offset equals 1. } ... function PosEx(const SubStr, S: string; Offset: Cardinal = 1): Integer; var I,X: Integer; Len, LenSubStr: Integer; begin if Offset = 1 then Result := Pos(SubStr, S) else begin I := Offset; LenSubStr := Length(SubStr); Len := Length(S) - LenSubStr + 1; while I <= Len do begin if S[I] = SubStr[1] then begin X := 1; while (X < LenSubStr) and (S[I + X] = SubStr[X + 1]) do Inc(X); if (X = LenSubStr) then begin Result := I; exit; end; end; Inc(I); end; Result := 0; end; end; ... |
Re: Pos info ???
Darf man das so einfach online stellen? Is das nicht copyrighted?
|
Re: Pos info ???
Denke mal solange es Delphi Intern bleibt, wird da keiner was sagen :)
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 00:50 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