TIP: Click on subject to list as thread! ANSI
echo: z3_pascal
to: Bob Lawrence
from: David Drummond
date: 1996-05-01 19:05:42
subject: StringToInteger

Bob, at 08:48 on Apr 30 1996, you wrote ...

BL>> my string is just a number with junk I don't care about 
BL>> following it.
BL>  
BL>  
BL>> function StrInt(s: string): integer;
BL>> var
BL>> i, size: integer;
BL>> begin
BL>>    i := 1; size := 0;
BL>>    while s[i] in ['0'..'9'] do begin
BL>>       size := size * 10 + (Ord(s[i]) - 48);
BL>>       inc(i);
BL>>    end;
BL>>    StrInt := size;
BL>> end;

DD>> Check out VAL()

BL> VAL() gets upset by the junk following the numbers in the 
BL> string. If I strip[ the junk and run val() on the new string, 
BL> it takes longer.

What are you timing it with?

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

You want me to?

David
@EOT:

--- Msgedsq/2 3.10
* Origin: JabberWOCky CBCS +61 7 3868 1597 (3:640/305)
SEEN-BY: 633/267 270
@PATH: 640/305 820 711/409 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™.