Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

vartoint

50 views
Skip to first unread message

D-Fan

unread,
Jul 31, 2008, 9:56:45 AM7/31/08
to
Just curious, why is there not a vartoint function?

Craig Stuntz [TeamB]

unread,
Jul 31, 2008, 10:13:04 AM7/31/08
to
D-Fan wrote:

> Just curious, why is there not a vartoint function?

Because assignment solves that problem just fine.

var
V: Variant;
i: integer;
begin
V := 6;
i := V;

--
Craig Stuntz [TeamB] · Vertex Systems Corp. · Columbus, OH
Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
All the great TeamB service you've come to expect plus (New!)
Irish Tin Whistle tips: http://learningtowhistle.blogspot.com

Craig Stuntz [TeamB]

unread,
Jul 31, 2008, 1:49:39 PM7/31/08
to
D-Fan wrote:

> What if the variant is null when you try this statement?

You can test for that. If you need a routine, write it; it's
completely trivial.

--
Craig Stuntz [TeamB] · Vertex Systems Corp. · Columbus, OH
Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz

How to ask questions the smart way:
http://www.catb.org/~esr/faqs/smart-questions.html

D-Fan

unread,
Jul 31, 2008, 1:45:12 PM7/31/08
to
Craig Stuntz [TeamB] wrote:
> D-Fan wrote:
>
>> Just curious, why is there not a vartoint function?
>
> Because assignment solves that problem just fine.
>
> var
> V: Variant;
> i: integer;
> begin
> V := 6;
> i := V;
>
I know that that can be done, but why is there not a var to int? What if
the variant is null when you try this statement?

You can do the same process above with strings, but it is not reliable.

0 new messages