mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-10-31 11:53:42 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			19 lines
		
	
	
		
			367 B
		
	
	
	
		
			ObjectPascal
		
	
	
	
	
	
			
		
		
	
	
			19 lines
		
	
	
		
			367 B
		
	
	
	
		
			ObjectPascal
		
	
	
	
	
	
| Program Example82;
 | |
| 
 | |
| {$mode objfpc}
 | |
| 
 | |
| { This program demonstrates the StrToInt function }
 | |
| 
 | |
| Uses sysutils;
 | |
| 
 | |
| Begin
 | |
|   Writeln (StrToIntDef('1234',0));
 | |
|   Writeln (StrToIntDef('-1234',0));
 | |
|   Writeln (StrToIntDef('0',0));
 | |
|   Try
 | |
|     Writeln (StrToIntDef('12345678901234567890',0));
 | |
|   except
 | |
|     On E : EConvertError do
 | |
|       Writeln ('Invalid number encountered');
 | |
|   end;
 | |
| End. | 
