[Gambas-user] casting or changing datatype.

nando nando_f at ...951...
Sat Jan 14 05:42:59 CET 2006


I believe that you are looking for is Variant

Public Function myResult (thestr as String) as Variant

if thestr = "Hello" then Return 0          'This is a integer
if thestr = "Bye"   then Return "Daytime"  'This is a String
if thestr = "PI"    then Return 13.14159   'This is floating

END

-Fernando

---------- Original Message -----------
From: johnf <jfabiani at ...1109...>
To: gambas-user at lists.sourceforge.net
Sent: Fri, 13 Jan 2006 18:10:09 -0800
Subject: [Gambas-user] casting or changing datatype.

> Hi,
> I wonder if it is possible to pass a string to a method and have the 
> string used to for the name of a different datatype.
> 
> dim passStr As String
> 
> passStr = "custData"
> myresult(passStr)
> 
> public sub myResult( thestr as String) as Result
> 
> dim thestr as Result
> 
> return Result
> end
> 
> John
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log 
> files for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
------- End of Original Message -------





More information about the User mailing list