Copy
Previous  Top  Next


Prototype

StrSubstr:=Copy(strString,intStart,intLen)  

Description

It catches a substring from string by starting from the specified position and lenght

Parameters

StrString:
original string where exstracting the substring.

IntStart:
integer value corresponding to the original position.

IntLen
: integer value corresponding to the length characters substring

Returned value

StrSubstr:
substring equivalent to the sequence of characters from IntStart position,of length IntLen

Notes

None.

Example


// It opens the file
UnFile:=TextFileOpen('c:\Example.txt',false);

//Variable inizialization
text:='';

//It reads and stores the file content in the Text variable  
While not TextFileEof(Unfile)do  
begin  
Text:=TextFileReadln(unfile)+''+Text;  
end;  

//It looks for a string inside the Text and it stores the position 
Position:=Pos('Aldo Rossi',Text);

//If string is found then 
if Position<>0 then 
begin  
//It copies the text in a string from Aldo Rossi till the end of file   
StrAldo:=Copy(Text,Position,length(Text));  
 
//It shows the result in a message   
ApplicationLog(_CurrentAgent,''+ StrAldo);  
end;  

// It closes the file
TextFileClose(UnFile);