Table of Content
HAL Forum
function LongInt FindStringInArea (
string SearchKey,area Target)
Description:
Returns the FIRST position of specified string in an area. When the value is found from the beginning of the string, then the returned value is 1. Return value -1 indicates failure.
Parameters:
SearchKey The text to look for.
Target The data that will be searched for specified search key.
// NOTE 8/3/2011: If you search for something that situates in the end of the area 
// (for example if the area contains a string: "this is just a test", and you search for 
// "test") then the funciton returns -1. A workaround for this is to add ...
//
// AddStringToArea("",[area]);
// 
// ... before using the funciton.

global
procedure OnApplicationStartup() 
begin
  area a;
  string 40 extracted,s,e;
  
  AddStringToArea("this is a really simple example",a);
  AddStringToArea("",a);
  s = "rea";
  e = "ample";
  extracted = GetStringFromArea(a,FindStringInArea(s,a),FindStringInArea(e,a)+len(e));
  
  return;
end;

Related topics:
««