TIP: Click on subject to list as thread! ANSI
echo: z3_pascal
to: Peter Lavender
from: Bob Lawrence
date: 1996-05-04 10:06:22
subject: StringToInteger

BL>   If I go val('223 Sheep Street'); I get zero and a fault at 4. Val
 BL> can't handle the Sheep.


 PL> Val is good for checking if the string entered in is an integer..

 PL> ie

 PL> var
 PL> CheckNum: string;
 PL> Number,ErrorCode: integer;

 PL> begin
 PL> WriteLn('Enter Number');
 PL> ReadLn(CheckNum);
 PL> val (CheckNum,Number,ErrorCode);
 PL> if ErrorCode = 1 then
 PL> WriteLn('Not an integer');
 PL> end.

  What a good idea! I'd never thought of using Val the other way.

 PL> Other than that the only way to convert your string to an
 PL> integer is to make sure that the string is an integer anyway.
 PL> Your function isn't that slow is it??

  (grin) It's as fast as I can make it, but I use it too often. It
looks like I'll have to turn it around so that I staret with integers
and convert some of them to strings, rather than the other way around.

Regards,
Bob
___ Blue Wave/QWK v2.12
@EOT:

---
* Origin: Precision Nonsense, Sydney (3:711/934.12)
SEEN-BY: 633/267 270
@PATH: 711/934 809 808 50/99 635/544 727 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.