mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-10-31 08:51:37 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			28 lines
		
	
	
		
			422 B
		
	
	
	
		
			ObjectPascal
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			422 B
		
	
	
	
		
			ObjectPascal
		
	
	
	
	
	
| {
 | |
|   Example library
 | |
| }
 | |
| library subs;
 | |
| 
 | |
| function SubStr(CString: PChar;FromPos,ToPos: Longint): PChar;
 | |
|    cdecl; export;
 | |
| 
 | |
| var
 | |
|   Length: Integer;
 | |
| 
 | |
| begin
 | |
|   Length := StrLen(CString);
 | |
|   SubStr := CString + Length;
 | |
|   if (FromPos > 0) and (ToPos >= FromPos) then
 | |
|   begin
 | |
|     if Length >= FromPos then
 | |
|       SubStr := CString + FromPos - 1;
 | |
|     if Length > ToPos then
 | |
|     CString[ToPos] := #0;
 | |
|   end;
 | |
| end;
 | |
| 
 | |
| exports
 | |
|   SubStr;
 | |
| 
 | |
| end.
 | 
