| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | StringToInteger |
BL> my string is just a number with junk I don't care about
BL> following it.
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()
VAL() gets upset by the junk following the numbers in the string. If
I strip[ the junk and run val() on the new string, it takes longer.
If I go val('223 Sheep Street'); I get zero and a fault at 4. Val
can't handle the Sheep.
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™.