Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Turbo Pascal - <b> val convert string to number pp 70</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 VAL                       Convert String to Number                    pp 70

 Syntax:  Val (StrVar,NumVar,Code) ;

 Type:    Integer or Real

 Form:    Procedure

 Purpose: Convert string value of StrVar to a numeric value in NumVar.

 Notes:   NumVar is type Intger or type Real.  Code is any error code.
          No errors occurred if Code = 0.


 ----------------------------------------------------------------------------


 Usage:
       CONST
          StrVar  : String [4] = '1234' ;  { String value of 1234 }
       VAR
          Code    : Integer             ;  { Error code           }
          IntVar  : Integer             ;  { Integer variable     }
          RealVar : Real                ;  { Real variable        }

       BEGIN
          Val ('$FFFE',IntVar, Code)    ;  { '-2'                 }
          Val ('1.123',RealVar,Code)    ;  { '1.1230000000E+00'   }
          Val (StrVar, IntVar, Code)    ;  { '1234'               }
       END.

See Also: Str Write

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson