|
Returns the start position of the search keyword in a specified string. If the keyword match is found from the very beginning of the target string then the returned value is 0. |
|
Haystack |
The string from where to search. |
Needle |
The string to look for. |
|
external function Integer InString2(string,string);
procedure SearchinInvCommentString(record COVc COr,string searchstring,Integer leng,var string res)
BEGIN
Integer where;
string 255 tstr,tstr2;
string 255 t2,t3;
tstr = res;
where = InString2(res,searchstring);
if (where>=0) then begin
tstr = Left(res,where);
tstr2 = Right(res,len(res) - where - len(searchstring));
if (searchstring=="V_PE") then begin
t3 = COr.startDate;
t3 = t3 & ":";
t3 = t3 & COr.endDate;
end;
if (searchstring=="V_CU") then begin
t3 = COr.Addr0;
end;
tstr = tstr & t3;
tstr = tstr & tstr2;
end;
res = Left(tstr,leng);
RETURN;
END;
««