Casting 
Author Message
 Casting

How would I cast from a string to a boolean?


Wed, 21 Jan 2004 07:50:04 GMT  
 Casting

Quote:

> How would I cast from a string to a boolean?

Nevermind, figured it out...


Wed, 21 Jan 2004 08:31:32 GMT  
 Casting

Quote:



> > How would I cast from a string to a boolean?

> Nevermind, figured it out...

dim b as boolean
dim s as string
s="true"
b=(s="true")
s="anythingElseOrFalse"
b=(s="true")

This?



Sat, 24 Jan 2004 19:40:42 GMT  
 Casting

Quote:




> > > How would I cast from a string to a boolean?

> > Nevermind, figured it out...

> dim b as boolean
> dim s as string
> s="true"
> b=(s="true")
> s="anythingElseOrFalse"
> b=(s="true")

> This?

Exactly


Sun, 25 Jan 2004 00:31:44 GMT  
 Casting
You can also do it via a variant:-

dim temp as Variant
dim s as String
dim b as Boolean

s = "True"
temp = s
b = temp    ' "temp" now contains a boolean true

This doesn't seem to be documented, but an e-mail to RB tech support
confirmed it to be a supported feature.

&.

----------

Quote:





>> > > How would I cast from a string to a boolean?

>> > Nevermind, figured it out...

>> dim b as boolean
>> dim s as string
>> s="true"
>> b=(s="true")
>> s="anythingElseOrFalse"
>> b=(s="true")

>> This?

> Exactly



Fri, 06 Feb 2004 21:04:37 GMT  
 Casting

Quote:

> You can also do it via a variant:-

> dim temp as Variant
> dim s as String
> dim b as Boolean

> s = "True"
> temp = s
> b = temp    ' "temp" now contains a boolean true

> This doesn't seem to be documented

Unless you count p. 149 of my book. m.

--

          *** REALbasic: The Definitive Guide! ***
http://www.amazon.com/exec/obidos/ASIN/0596001770/somethingsbymatt
             -- The Second Edition is coming! --



Fri, 06 Feb 2004 23:06:46 GMT  
 Casting
In article


Quote:


> > You can also do it via a variant:-

> > dim temp as Variant
> > dim s as String
> > dim b as Boolean

> > s = "True"
> > temp = s
> > b = temp    ' "temp" now contains a boolean true

> > This doesn't seem to be documented

> Unless you count p. 149 of my book. m.

   I can't wait 'til Matt gets out an edition covering the 3d control.

   Well, maybe I can wait. I won't die or anything...

--
 --



Sat, 07 Feb 2004 10:04:45 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Casting and constructor method conflict

2. Variable casting

3. Cast Off 1.2 Released!

4. awk equivalent for casting char to int?

5. Type casting?

6. Type casting

7. Casting Error IN SQL...

8. mssql cast error

9. type cast

10. Invalid Character Value for Cast Spevification

11. Cast Down's

12. what cast type are used for?

 

 
Powered by phpBB® Forum Software